Saving routinely accessed hosts and commands
So far, we've been typing in our username and server hostname every time we want to connect to a server. As we get more and more servers, or more advanced configuration, we'll want to save these connection details and not have to type them at the command line every time!
Our SSH client will read the ~/.ssh/config
file, which can store a list of hosts and their SSH configuration. This works for both Windows and Linux hosts, and we can provide memorable names for each host. For example, the following configuration will allow us to type ssh home
and connect to the server with these details:
Host "home" HostName home-server.example.com Port 22 User William IdentityFile ~/.ssh/id_ed25519
This can be especially useful if we don't have a hostname, and we need to connect by IP. For example, we can associate the name ...