Does SFTP use port 21 or port 22?
-
7That depends what port you configured it to use.. – Tom O'Connor Apr 13 '11 at 10:43
-
21Why 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
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.
-
7sftp command line syntax for alternate ports
sftp -oPort=### user@server.tld
– here Nov 8 '13 at 4:06 -
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:
-
I agree that sftp listens on 22, but why does my /etc/services say it's 115 (on Ubuntu)? – Paul A Jungwirth Jul 29 '14 at 18:32
-
3@Paul-A-Jungwirth: It's just the same acronym for unrelated protocol. SFTP on port 115 stands for Simple File Transfer Protocol - en.wikipedia.org/wiki/Simple_File_Transfer_Protocol. The SFTP on port 22 is SSH File Transfer Protocol. en.wikipedia.org/wiki/SSH_File_Transfer_Protocol – Martin Vobr Jul 29 '14 at 21:44
SFTP will also use data ports at higher ranges. SSH will remain the control port. It uses more than 22 in most instances...
-
5This answer is incorrect. SFTP transfers all data over the SSH connection. No additional port is used. – kasperd Jul 11 '14 at 6:28