Feb 232013
 

I used the following command to copy some photos of a New Year’s party from a remote server to the one that I was logged into. The “~” tells scp to start at the root of the user profile. Notice that I used the quotes after the colon and double backslashes where there was a space in the filename.

scp username@servername:"~/Pictures/Chinese\\ New\\ Year\\ Baghdad\\ Iraq\\ 2013/Original/*" .

Jul 072010
 

If you want to connect to remote machine named othermachine as user named othermachineuser.

On your local machine you need to generate a private-public keypair using ssh-keygen as follows (You only need to do this once):
ssh-keygen -t dsa

This will create a private and public keypair which is stored in ~/.ssh directory.

Next run the following command once for every machine you want to remotely login without specifying password:
scp ~/.ssh/id_dsa.pub othermachineuser@othermachine:~/.ssh/authorized_keys

Now you can login to the machine using ssh without requiring to specify any password. Your public key, which you copied to the remote machine, is checked (not directly) against your private key to verify your authenticity.

Jan 152010
 

From here to there:
scp filename userid@hostname:filename
scp filename userid@hostname:/path/to/filename

From there to here:
scp 192.168.1.100:*.txt .
scp userid@hostname:*.txt .
scp userid@hostname:/path/to/filename

Directories from here to there:
scp -r directoryname userid@hostname:directoryname2

Directories from there to here:
scp -r userid@hostname:directoryname2 .