How to make SFTP server listen on a specific port?

Published on Aug. 22, 2023, 12:18 p.m.

To make an SFTP server listen on a specific port, you will need to modify your SFTP server’s configuration file. The steps vary depending on the specific SFTP server software you are using, but in general, you should look for a configuration file that specifies the port number, which is usually located in the “etc” or “conf” directory of the SFTP server installation.

Here is an example of how to change the port number for the popular SFTP server software “OpenSSH” on a Linux or Unix server:

  1. Connect to your server using SSH.
  2. Open the OpenSSH configuration file /etc/ssh/sshd_config in a text editor.
  3. Find the line that reads #Port 22.
  4. Remove the # character to uncomment the line.
  5. Change the number 22 to the desired port number.
  6. Save the file and exit the editor.
  7. Restart the SSH service by running the command sudo service sshd restart or sudo systemctl restart sshd.service.

After completing these steps, your SFTP server should now be listening on the specified port.

Keep in mind that changing the default port for SFTP may impact compatibility with other software and may require you to modify firewall rules or security policies accordingly.

Tags: