📅 June 26, 2013
As a fun experiment, I set up a networking test bed to determine which protocol would transfer data faster over a LAN: SSH (Secure Shell) or FTP (File Transfer Protocol)?
- Two computers with equivalent-speed hard drives and running Linux Mint 15
- Gigabit wired LAN
- 1.6 GB file of nonsense random data that does not compress (dd and /dev/urandom are your friends)
- Filezilla FTP client
- Caja and Nemo file managers
- vsftpd FTP server for FTP
- OpenSSH server for SSH
Transfer Speed ------------------------------------- SSH to SSH 14 MB/s FTP to FTP 60 MB/s
The winner: FTP.
Files were transferred both ways between the computers, and there was no other network activity. The 14 and 60 MB/s were fairly consistent hovering around 13.9 to 14.2 and 59.8 to 61.1. Filezilla, Caja, and Nemo all report the file transfer rate in MB/s, and this value was recorded once the file transfer speed had stabilized. Only one file was transferred at a time.
The test was performed multiple times using different FTP clients and always showed similar results.
Keep in mind that there are other weak links in the data transfer chain that might increase or decrease the speed. With the test hardware available, these were the consistent results.
There are multiple FTP servers available for Linux. Some have GUIs, and others rely upon text configuration files. vsftpd is the Very Secure FTP Daemon, which is extremely easy to set up by editing a single configuration file (for the basics) located at /etc/vsftpd.conf.
vsftpd claims to be faster and more secure than other FTP servers by implementing workarounds and protections for certain exploits possible with the FTP protocol. I was very pleased with the performance of vsftpd and the steps it took to improve the security of an otherwise insecure protocol.
vsftpd is available in the Ubuntu repository and has its own web site for more information.
Keep in mind that FTP was developed in the early days of computing when people trusted each other, so it is not secure by default. It is a two-port protocol, it is insecure because data and commands–as well as usernames and passwords–are transferred in cleartext.
vsftpd does offer an option to encrypt logins and data transfers using SSL. According to my configuration file, SSL was enabled, but I did not notice any speed decrease because of it.
For data transfers over the public Internet, SSH is preferable even though its transfer rate is slower. For private LANs that you are in control of and without any danger eavesdropping, FTP seems to be a better choice due to its increased speed.