How to Use the Scp Command to Securely Send a File from Your Desktop to a Server
Learn how to use the scp command to transfer files securely with this step-by-step tutorial by expert Jack Wallen.
If you regularly have to copy files from your desktop to another desktop or server, you might not want to use less secure protocols such as FTP. Fortunately, Secure Shell includes a command that makes copying files to and from a remote machine not only secure but fairly easy. Let me show you how it’s done.
All you’ll need for this are two machines, both of which have SSH installed. The scp command does work with SSH key authentication, so if you have it enabled, you shouldn’t have any problems with the command. How does it work? Easy.
Say, for instance, you have the file trtest in the Documents directory on your desktop computer, and you want to copy it to your home directory on a machine at IP address 192.168.1.161. The command to copy that file to the server would be
scp Documents/trtest USER@192.168.1.161:/home/USER
where USER is your username.
You’ll be prompted for your remote password. Upon successful authentication, the file will copy to the remote server. If you want to copy that file from the remote server to your Documents directory on your local machine, the command would be
scp USER@192.168.1.161:/home/USER/trtest /home/USER/Documents
where USER is your username.
And that’s all there is to it. Thanks to the scp command, you can securely copy files to and from remote machines with ease.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.