What Is Default SFTP Port and How To Change SFTP Port Number? – POFTUT

What Is Default SFTP Port and How To Change SFTP Port Number?

SFTP is a secure version of the FTP. SFTP provides an encrypted channel with a remote server. This makes authentication and data transfer more secure than FTP. SFTP protocol is generally provided by SSH servers by default. In this tutorial, we will learn the default SFTP port and how to change it to a different one.

Linux Sftp Command With Examples

SFTP Default Port TCP 22

SFTP is a subsystem of the SSH service or daemon. So this makes SFTP listen TCP 22 port. We can use the following sftp command to connect remote system SFTP service.

$ sftp
SFTP Default Port TCP 22
SFTP Default Port TCP 22

Change Default SFTP Port

If we want to change the default SFTP port we need to change SSH configuration which will also change the default SSH port. We need to open the SSH config file /etc/ssh/sshd_config and change

 #Port 22

To whatever we want. In this example, we change to the 2222 . This configuration will be more secure because it is harder to find by attackers.

Port 2222
Change Default SFTP Port
Change Default SFTP Port

After we changed the configuration file we need to make active the new configuration. We should restart the SSH services which will reread the configuration file and use the new SFTP port number. We will use systemctl command but other service management commands are welcome.

$ sudo systemctl restart sshd
SSH Service
SSH Service

How To Specify Different SFTP For Client

During daily usage, we may need to connect remote SFTP server which port is different than default one which is TCP/22. We have to specify remote SFTP server port explicitly with the -P option and ports number to the sftp command.

$ sftp -P 2222 poftut.com


As stated previous SFTP is a function of the SSH protocol. So it is different than FTP mechanism. As FTP is not a secure or encrypted protocol it provides some security mechanism like SSL tunneling. FTPS or FTP SSL is secured version of FTP and shouldn’t be confused with SFTP. FTPS listen for regular FTP port 21 or whatever it is configured.


As SSH has two main versions name 1 and 2 SFTP is related to SSH. So in order to express an SFTP which works on only over SSHv2, we generally use SFTP2 . In another way SFTP2 will only work with `SSH version 2 services.

LEARN MORE  rsync Command Tutorial With Examples


All of these may seem the same as SFTP but they are not. They are used for FTP connections over SSL/TLS tunnels. They are different protocols. And they are using a different port than SFTP. They use FTP port which is TCP 21.


TFPT is a way different protocol which is similar to the FTP but provides fewer options. TFTP do no have any encryption or similar functions to secure remote data transfer. To get more details about TFTP please read the following tutorial.

How To Install, Configure and Run Linux Tftp Client

Leave a Comment