I've used the
ssh secure shell tool for several years. But it's been for the simple base case. Logging in on a remote machine. It never had a reason to delve deeper into it. That changed last weekend and I ended up learning a lot about.
Files used in ssh and their placement.
The files used by ssh are placed in two different places. /etc/ssh which contains the settings for the entire box. A base ssh configuration file and the files required for the ssh server. Inside the ~/.ssh are the user specific files.
- known_hosts This file contains a listing of the hosts we've already visited and know are good. This is used by ssh to identify whether a remote host may have been tampered with or if we are accidentally trying to access a host we didn't intend to.
- ssh_config User specific configuration for accessing various host. I use this to specificy what key to use to access various hosts and set what user account to login as. This is useful as my username on my personal box is "Andreas" and my work username is "APedersen", so by setting this for all work specific boxes it saves me typing.
- Identity files SSH support various forms of identification such as rsa or dsa. It will automatically try keys with default names like id_rsa when trying to ssh into a box. But there keys doesn't need to have names in this specific format. Anything goes. You just have to either add the keys to
ssh-agent, specificy the identityfile whehn estabilishing the connection or set it in the ssh_config file.