File transfer protocols allow users to transfer data between remote systems over the Internet. SFTP is one such protocol, offering users a secure way to send and receive files and folders.
In this tutorial, we will go over what SFTP is, how it works, when to use it, and which benefits it offers compared to other file transfer protocols.
SFTP (Secure File Transfer Protocol) is a file transfer protocol that uses SSH encryption to transfer files between systems securely. It comes as a standard part of SSH version 2.0.
SFTP allows users to choose the level of authentication they want to use when transferring files. Users can transfer files using SFTP with no added authentication, using a combination of user ID and password, or using a pair of SSH keys.
SFTP was developed as a more secure alternative to FTP (File Transfer Protocol). Even though they share some similarities, SFTP is a subsystem of SSH and separate from FTP.
FTPS (FTP Secure) is an extension of FTP that upgrades file transfer security by adding support for cryptographic protocols. Earlier versions of FTPS used SSL encryption but have since moved to use TLS.
While both SFTP and FTPS offer a secure way to transfer files using the Internet, they use ports in a very different way. SFTP uses only a single port to establish a connection between a client and an SFTP server. In contrast, FTPS opens a new port for each file transfer request, which can cause problems with firewalls.
Most firewalls detect when users open a new port for data transfer. However, since FTPS uses SSL/TLS encryption, the firewall doesn't detect what the new port is used for, which causes the connection to fail. While users can resolve this issue by manually opening a limited range of ports, SFTP offers a solution built into the protocol itself.
SFTP is used whenever there is a need to transfer files between systems while maintaining a high level of security.
Potential uses for SFTP include:
Using SFTP to transfer files offers numerous benefits.
Unlike some other file transfer protocols, SFTP was built from the ground up with security in mind. It ensures the safe transfer of data by using several security measures:
Regulations such as PCI-DSS, HIPPA, GDPR, CCPA, SOX, or GLBA set a standard for secure file transfer. Failure to comply with these standards can result in substantial penalties.
Many of these regulations specify the need for encryption when transferring sensitive files. SFTP makes it easy to comply by including encryption as a default security measure when transferring data.
SFTP also offers advanced features such as pausing and resuming file transfer. It allows users to perform basic administrative tasks remotely, like creating, renaming, and removing files and directories.
SFTP can also transfer file metadata by default, unlike many other file transfer protocols. These include file size, date and time, and file permissions.
File transfer protocols, including SFTP, make it easy to transfer large files or perform a bulk file transfer (transferring multiple files at once). SFTP is a more efficient solution than emails or cloud data storage for businesses with high data traffic needs.
Users can also automate SFTP file transfers by setting up triggers. These triggers can transfer files at a predetermined time or during certain events. This increases efficiency and reduces the chance for human error.
SFTP supports user-to-server and server-to-server configurations. Data stored on SFTP servers is available at all times, both to users and other servers.
ETL (Extract, Transform, and Load) is a commonly used method of data integration. Reverse ETL does the same thing, except it reverses the order of operations.
Reverse ETL relies heavily on transferring files between systems. SFTP provides a way to safely and efficiently transfer data between vendors, customers, and other third parties, which greatly helps the reverse ETL process.
An SFTP file transfer starts with a transfer request from a client system. SFTP uses port 22 to open a secure connection between the client and the SFTP server.
The server then reads the transfer request and encrypts the appropriate file using SSH. SFTP sends the file to the client, who uses SSH authentication to decrypt and access the file.
Note: Learn more about how SFTP works in our guide.
Using SFTP requires setting up a connection between the client system and the SFTP server using SSH. A commonly used option is to connect the two systems using an SSH public key.
Since SFTP comes as a standard part of SSH, no additional installation is necessary. To start using the SFTP interface to transfer files, connect to the remote server by providing a username and remote hostname or IP address:
sftp [username]@[remote hostname or IP address]
In the example below, we access the 192.168.100.5 IP address using the phoenixnap username:
sftp phoenixnap@192.168.100.5
The SFTP interface, indicated by sftp> , allows you to request file transfers and execute SFTP commands.
Once you are done using SFTP, end the current connection with:
exit
SFTP offers a reliable way to transfer files and directories, with the added security of SSH encryption. To learn, read our article on how to use SFTP to transfer files.