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:
- Connect to your server using SSH.
- Open the OpenSSH configuration file
/etc/ssh/sshd_config
in a text editor. - Find the line that reads
#Port 22
. - Remove the
#
character to uncomment the line. - Change the number
22
to the desired port number. - Save the file and exit the editor.
- Restart the SSH service by running the command
sudo service sshd restart
orsudo 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.