More Fun With SSH
Last week's Tip of the Trade looked at how to stop your SSH session from dropping out, using the .ssh/config file. This file can also set many other settings, either globally or on a per-host basis. Note that SSH uses the first option it encounters, so per-host options should go before global options in the file. Tip of the Trade: SSH can set a host of settings on either a global or per-host basis. Check out these especially useful ones.
SSH keys and ssh-add are useful to minimize password-typing. But you don't necessarily want to use the same key for all the machines you log onto, which requires more typing, to -i keyfile on the command line. Alternatively, you can set the identify file per host with a section like this in your ~/.ssh/config file:
Similarly, the -X and -Y command-line options enable X11 forwarding and trusted X11 forwarding, respectively. If you always want to forward X11 but only want trusted X11 for a particular machine, try this:
Host desktop.example.com ForwardX11Trusted yes Host * ForwardX11 yes |
Host longname.machine.example.com HostName lmach User julietkemp-longname |
