Copy Files Securely Between Local Machine & Shell Account

by AndrzejL

Lets say that I have created a VERY important file. Its a file called example.txt, and it’s placed in my home (~) folder:

touch ~/example.txt

I want to copy this file to my remotemachine.net, mylogin’s home folder, but I don’t want anyone to be able to sniff the file’s content. The remote machine has SSH server running. Scp is perfect for this task. It uses encrypted ssh.

How to use it?

Syntax:

scp /path/to/secret/file.ext who@host:/where/to/save/

Example:

scp ~/example.txt mylogin@remotemachine.net:~

Result:

example.txt 100% 0 0.0KB/s 00:00

Check procedure:

Log into the remote machine:

ssh -l mylogin remotemachine.net

List the file:

ls ~/example.txt

Tada!

/home/mylogin/example.txt

I hope you find this helpful.