There are many ways to transfer files to and from a web server. The most common method is FTP (file transfer protocol), but it is not secure and opens up your website to the possibility of being exploited. Among the secure alternatives is a method called SCP, which stands for Secure Copy. Using the Secure Shell (SSH) protocol, it allows you to securely transfer files from one host to another host over a local network or the Internet. We will cover two methods of transferring with SCP, one from the command line and the other using a graphical tool.
On a Linux-based or Unix-based computer such as Ubuntu, FreeBSD, or Mac OS X, you should already have the necessary tools to run SCP from the command line. On Windows, you will need to install software such as PuTTY in order to connect to a remote server over SSH.
The formula for copying files with SCP is as follows:
scp localfile username@host:/path/to/destination/directory
This copies a file from your current directory. If you need to copy from another directory, specify the whole path:
scp /path/to/local/file username@host:/path/to/destination/directory
For example, if you want to copy a file called “statistics.txt” from your local machine to a host called myhost.tld, with the username “elmo”, you would type the following:
scp statistics.txt email@example.com:/home/user/bigbird/stats
Every graphical program approaches SCP differently, and most support other transfer methods, such as FTP, SFTP, and even WebDAV.
For Windows, a common SCP tool is WinSCP, which is free to use and open source.
For Mac OS X, you can use Fugu, which is also free and open source.
For Linux, you can use gFTP or also use the SSH-based secure transfer methods supported by your OS, such as KDE’s Dolphin file manager, which has built-in support.
SCP is a good for quick file copying, but it is not as robust as SFTP, which supports additional tasks like remote file management, directory listings, and more. If you want a true alternative to FTP for full file management, go with SFTP instead. Nevertheless, for quick file copying, SCP servers a good purpose.