Photo by Cameron Venti on Unsplash

If you stumbled upon this page in search of information about ships and the ports they load cargo onto, then your google search is a bit off, because this post is all about server ports and data transfer protocols. If you belong to the IT / programming folk, you’re in the right place.

What are ports?

Computers and servers communicating over the TCP and UDP protocols are able to connect and transfer data by virtual endpoints, otherwise known as ports. When a program binds to a specific port, it listens to the given incoming communication on that port and permits other computers to connect to and pass data through it. Ports are defined by numbers, starting at 0 and ranging to 65,535.

The lower numbers are standardized and assigned to common internet protocols such as SMTP (port 25), HTTP (port 80), and HTTPS (port 443).

What is SFTP?

SFTP is a secure file transfer protocol that utilizes the SSH (Secure Shell) protocol to establish an authenticated connection. SSH provides authentication methods such as username/password and private/public key and it also encrypts all communications between client and server using cryptographic algorithms. SFTP, similarly to FTP, also works in a client-server architecture: once the client is authenticated and the connection is established, the client can upload, download and manipulate the files and directories it has access to on the server.

SFTP ports

By default, SFTP uses SSH’s default port - port 22 for authentication,control, and data transfer. This makes it very simple to manage inbound and outbound network rules, an advantage over other protocols.

FTP and FTPS, on the other hand, use two separate channels for control and data. The data channel uses random ports, which requires setting up NATs and firewalls to allow the server to connect back to the client or to allow the client to connect to a wide range of ports on the server in order to open the data channel on a random port which is more cumbersome and poses a security risk.

If you are interested in further getting to know the characteristics and differences that these protocols possess, you can read more about them here.