168

Does SFTP use port 21 or port 22?

  • 7
    That depends what port you configured it to use.. – Tom O'Connor Apr 13 '11 at 10:43
  • 21
    Why when everybody asks for default settings somebody thinks that this is the case when user asks something else then that? – holms May 19 '11 at 13:53
218

While TCP port 22 is the general right answer, this is dependent on the fact that SSH is configured to use the standard port and not an alternative port.

As SFTP runs as a subsystem of SSH it runs on whatever port the SSH daemon is listening on and that is administrator configurable.

108

SFTP usually uses port 22 but can be configured to run on nearly any port.

Port 22 is generally used for connection via SSH. SFTP is just one of protocols which can be run over SSH (others include virtual terminal). In fact, the SFTP is independent and can be run even without using SSH.

SFTP is sometimes called "Secure FTP" which leads to a common confusion with FTPS (which is called "Secure FTP" too).

Generally:

SFTP - SSH File Transfer Protocol - usually runs over TCP port 22

FTP - plain, old file transfer protocol - usually runns over TCP port 21 (+ opens separate ports for data transfer)

FTP/SSL - FTP over TLS/SSL channel.

FTPS - same as FTP/SSL

Secure FTP - either SFTP or FTPS

More info:

14

It uses whatever port SSH is setup to use.

9

Its uses Port 22.

-8

SFTP will also use data ports at higher ranges. SSH will remain the control port. It uses more than 22 in most instances...

  • 5
    This answer is incorrect. SFTP transfers all data over the SSH connection. No additional port is used. – kasperd Jul 11 '14 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.