In this article, we will show you how to use SCP for secure file transfer between your local computer and your InMotion Hosting server. SCP uses SSH to make a secure connection to the server. This means that in order to complete a safe, secure file transfer, you will not need to install any additional software. Your computer should already have a Terminal or shell application you can use to transfer your files. If you don’t have one, and you use Windows, we recommend installing Putty. For Mac and GNU/Linux users, we recommend using the default Terminal application your operating system has provided for you.
In this article, we’re going to show you how to both upload and download files using SCP. In order to complete both sections you should have a terminal or shell application open and ready.
Why Use SCP?
SCP is especially valuable for users who are interested in PCI Compliance. Complying with strict security parameters often means closing Port 21 in your server, which FTP uses. SCP is based on the SSH protocol, so it is more secure and uses Port 22.
As an alternative to SCP, we recommend SFTP, which is also uses Port 22.
How to Upload a File with SCP
The SCP command has three parts. First, you will call the command itself and then provide two locations.
chris@computer# scp(1) file location(2) upload location (server)(3)
The difficulty you may at first encounter is providing the exact directory path to the files you are working with. Below, we will give an example of what a directory path may look like on a Mac or GNU/Linux command line.
For this example, we’ll assume you have a local file called doc.txt in your Documents folder on your computer and you want to upload it to the document root of your website. In this case, the SCP command would look as follows:
chris@computer# scp ~/Documents/doc.txt [email protected]:~/public_html
To specify a custom SSH port, add -P and the port after scp:
chris@computer# scp -P 1234 ~/Documents/doc.txt [email protected]:~/public_html
To specify an SSH key for better security, here’s how it would look:
chris@computer# scp -i ./SshKeyFile ~/Documents/doc.txt [email protected]:/root
Once you have this command written in, you can press the Enter or Return key to run it.
You will see a progress indication to let you know that the connection was made and the file transfer completed successfully:
doc.txt 100% 10 0.0KB/s 00:00
How to Download a File with SCP
In order to download a file from the server, we will replicate the process above, but we will be reversing the file locations. Now, the first position will be the server location and the second position will be the the desired destination on your computer.
chris@computer# scp [email protected]:~/public_html/doc.txt ~/Documents/
You will see a similar progress indicator as the one listed above to let you know that the transfer was successful.
Wait! There’s More
As you may have come to expect, command lines are endlessly configurable when combined with other programs and options. To learn more about SCP and its advanced options, while in your shell, type this to access the SCP manual:
Well done! You now know how to use SCP for secure file transfer between your computer and your InMotion Hosting server.
Learn more from our Cloud Server Hosting Product Guide.
If you don’t need cPanel, don't pay for it. Only pay for what you need with our scalable Cloud VPS Hosting.
CentOS, Debian, or Ubuntu No Bloatware SSH and Root Access