rearsync.com Sync’n since 2008…
Categories: Computers, Networking, Security, linux, unix

Got to get a file to another host quickly and easily? All you have open between the two hosts is SSH ?  SCP to the rescue.  SCP is part of the SSH suite, and unlike FTP, its a secure, encrypted protocol.   Here are two command that will get you using it in notime.

// This will upload some file from your local machine to a remote computer

~# scp <local_file> user@hostname:<remote_file_destination>

ex.

~# scp filename.txt n00b@mcn00b.net:/home/n00b

// This will allow you to get a file from a remote host to your machine

~# scp user@remotehost:<remote_filename> <local_filename>

ex.

~# scp n00b@mcn00b.net:/home/n00b/filename.txt filename.txt

You can also do entire directory’s by adding the -r flag.

This is a very useful command, especially if you have SSH keys setup between your two machines.  I’ll write a post about setting up ssh keys in a future post.

As always, man scp for more info.

1 Comment

January 13th, 2009

And if you want to automate the whole thing you just set up a pair of ssh keys using ssh-keygen.

I did a ton of that when I worked for the state.