Both SCP and SFTP run over TCP port 22 by default. Both are also used for transferring files. So are they one and the same? If not, what's the difference between the two? In this post, we compare them in terms of qualities essential to file transfers, namely: speed, security, functionality, support for large files, and support for resuming transfers. Let's see which protocol has the advantage.
When comparing SCP vs SFTP in terms of speed, i.e., in transferring files, SCP is generally much faster. This is due to the way it confirms received packets. Traditionally, SFTP has to ACK (acknowledge) every tiny packet, while SCP does not. That's why the disparity becomes more evident in high latency networks.
Because both protocols run on SSH, they're able to provide the same security features Secure Shell has to offer. That includes data-in-motion encryption and public key authentication. When combined with password authentication (which SSH also supports), public key authentication allows SCP and SFTP logins to be secured by two-factor authentication. Data-in-motion encryption and 2-factor authentication are required in data security and privacy laws/regulations like HIPAA and PCI-DSS.
SCP is built purely for file transfers. Generally speaking, you can't generate directory listings (to view files within a directory), create directories, delete directories, delete files, and so on. Yes, these can be done on SSH but not with SCP alone. SFTP, on the other hand, can readily perform these operations on its own. This can be particularly useful if you're doing things interactively from a file transfer client and you don't know (or don't remember) where the source file or destination folder is in your remote host.
4. Support for large file transfers
This is actually dependent on the application. Neither SCP nor SFTP have any file size limitations.
5. Support for resume file transfers
While SCP beats SFTP when it comes to speed, that comes with a trade off. The SCP command line client does not allow you to resume an interrupted file transfer. The best you can do is overwrite the partial file that was already copied/transferred. In the SFTP command line client, you can achieve this with the -a option of the 'get' command.
So does this mean SFTP is better than SCP? Not really. Unless you're using the SCP and SFTP command-line clients. But if you're using a file transfer client like AnyClient or a file transfer server like JSCAPE MFT Server, you won't notice any difference, as both protocols are implemented side by side.
Now that you know some of the advantages of scp vs sftp and vice versa, you might want to start learning how to use them. Here are some posts to get you started.
Looking for a secure file transfer server that supports SFTP, SCP, and other protocols? Check out JSCAPE MFT Server, a platform independent, multi-protocol, managed file transfer server. Download a free, fully-functional, evaluation edition here: