UBC Physics & Astronomy
SSH Tips

ssh-copy-id

Although using public key authentication instead of passwords is a great method for increasing the security of SSH transfers, transferring SSH identity keys can be a pain. First, you create your key pairs; then, you copy the public key into the correct locations on all the machines you want to log into. The keys must be in a particular format, and you must go into the correct directory with the correct permissions. Fortunately, ssh-copy-id, a utility included with OpenSSH, makes it easy.

$ ssh-copy-id -i id_rsa.pub terry@host2 
ssh-copy-id copies identity keys in the correct format, makes sure file permissions and ownership are correct, and ensures a private key is not accidentally copied.

Using key-based authentication instead of passwords means you don't have to give away system passwords.

sshfs

sshfs is a command for mounting an entire remote filesystem. It's much faster and easier than setting up a Samba or NFS server. First, create a local directory for the mountpoint, then fetch your remote filesystem:

$ sshfs user@hostname:/remotedir localdir/

Now, you can operate on the remote files as if they were local.

 

 

 

 

 

 

 

webmaster@phas.ubc.ca [Dept. Home Page] last updated: 08/01/11