What is the SFTP Port Number?

By LightNode ·

In the realm of digital communication, Secure File Transfer Protocol (SFTP) is a widely used protocol for securely transferring files over the network. SFTP not only provides file transfer capabilities but also adds encryption to protect the data during the transfer process.


This article will detail the workings of SFTP, its default port number, the characteristics of SFTP, the differences between it and FTPS, and provide examples of common SFTP commands. Finally, we will explore how to change the default SFTP port number to enhance system security.

What is SFTP?

Secure File Transfer Protocol (SFTP) is a protocol used for secure file transfer over the network. It is built upon the Secure Shell Protocol (SSH), ensuring the security and reliability of data transmission. SFTP encrypts all transmitted data, protecting it from man-in-the-middle attacks and other network threats. It supports not only the uploading and downloading of files but also file system operations, such as browsing, creating, and modifying files and directories.

What is the Default SFTP Port Number?

SFTP uses TCP port 22 by default for data transmission. This port number is the same as that used by the SSH protocol, as SFTP is implemented on top of SSH. The use of port 22 ensures the security and encryption of the data transmission process.

How Does SFTP Work?

The working principle of SFTP is based on the client-server model. Users (clients) establish a connection with the server using SFTP client software, requiring authentication, typically through a username and password or a key pair. Once the connection is established, users can start transferring files. All data transmitted via SFTP is automatically encrypted, ensuring its security.

Characteristics of SFTP

  • Encrypted Transmission: SFTP encrypts all transmitted data, ensuring its security during the transmission process.
  • Authentication: It uses username and password or key pairs for authentication, enhancing security.
  • File and Directory Operations: In addition to file transfer, it supports managing files and directories.
  • Cross-Platform Support: SFTP client and server software can run on various operating systems.

Differences Between SFTP and FTPS

SFTP and FTPS are both used for secure file transmission over the network, but they differ in how they implement security. SFTP is based on SSH, offering robust encryption and authentication capabilities. FTPS adds an SSL/TLS encryption layer on top of the traditional File Transfer Protocol (FTP). SFTP transmits all data through a single port, whereas FTPS may require multiple ports, potentially complicating firewall configuration.

Examples of SFTP Commands

SFTP provides a variety of commands to support file transfer and file system operations. Here are some common SFTP command examples:

  • ls: Lists the contents of the remote directory.
  • get filename: Downloads a file.
  • put filename: Uploads a file.
  • mkdir directoryname: Creates a new directory.
  • chmod permissions filename: Changes the permissions of a file.

How to Change the Default SFTP Port Number

Changing the default SFTP port number can enhance system security, as it becomes more difficult for attackers to scan and identify services on non-standard ports. To change the SFTP port number, you need to edit the SSH server configuration file (usually /etc/ssh/sshd_config) and then change the value of the Port directive to the new port number. After making changes, the SSH service must be restarted for the changes to take effect.


SFTP is an essential tool for secure file transmission over the network, ensuring data transmission security through encryption and robust authentication mechanisms. Understanding the default port number of SFTP, how it works, its characteristics, and how to use it correctly is crucial for protecting data transmission. While SFTP and FTPS each have their own features for implementing secure transmission, SFTP is widely used due to its simplicity and high security. By modifying the default port number, security is further enhanced. Mastering the use and configuration of SFTP is a valuable skill for anyone needing to securely transmit data over the network.