You can use scp (Secure CoPy) to copy files from one computer to another across any network, for example backup files. Files can be copied from a remote server to your own computer, vice versa, or even directly between remote computers.
scp assumes the source computer requires authentication. If the source file is world readable, use wget instead of scp.
COPYING FROM A REMOTE SERVER TO YOUR LOCAL BOX
In a terminal on your local box, cd to the destination directory, and:
scp firstname.lastname@example.org:path/to/source/file .
Notice the trailing dot, which indicates that the file should be copied to the working directory with the same name as the original file.
COPYING FROM YOUR LOCAL BOX TO A REMOTE SERVER
In a terminal on your local box, cd to the source directory, and:
scp filename email@example.com:path/to/destination/directory/
COPYING FROM ONE REMOTE SERVER TO ANOTHER
Using ssh, log in to the destination computer, cd to the destination directory, and:
scp firstname.lastname@example.org:full/path/to/filename .
Notice the trailing dot.
- -C: Use ssh compression. man ssh says “compression is desirable on modem lines and other slow connections, but will only slow down things on fast networks.”
- -p: Preserves modification times, access times, and modes from the original file. Use with care.
See the references and man scp for more useful options.
SSH and SCP: Howto, tips & tricks