To auto-login to other machines you must generate a key:
ssh-keygen # Don't enter anything at the prompts. If you enter a pass-phrase # then you will need to enter that every time you use this key. # which defeats the purpose of doing this.
...and copy the key to the server you wish to login to:
cat ~/.ssh/id_rsa.pub |ssh you@server "cat >> .ssh/authorized_keys2"
After that you can login to that box with no password.
Forward ports from one machine to another. Handy for boxes behind firewalls.
ssh -g -L 3306:localhost:3306 you@server # Forward the mysql port through the ssh port from localhost to # your server. (Much more secure too!)
Login as if you were logging in to localhost. Also handy:
ssh -R 5901:localhost:5901 firstname.lastname@example.org # Reverse Tunnel # Now run vnc on yourhost.com as if on localhost
STDIN and STDOUT can be redirected between machines through ssh.
# Copy a file between boxes: cat file.ext |ssh otherbox "cat > file.ext" # tar and gz some stuff and transfer it to another box: tar -cf - dir_to_backup |gzip -c -9 |ssh otherbox "cat > the_backup.tar.gz" # ...or decompress it when it gets to the other box. Handy for transfering # large (or a lot of) files to save bandwidth: tar -cf - lots of big files |gzip -c -9 |ssh otherbox "tar zxvf - -C /path/for/to/decompress"