Configuration of hosts for convenient ssh connections

2013-07-12
#ssh #linux #console

It is possible to save configuration of ssh connection for later usage. For example, one had to type

ssh <username>@<ip address> -p <port> -i <path to key file>

every time one wants to connect to server.

Create ~/.ssh/config with following content:

Host <name>
  Hostname <ip address>
  Port <port>
  User <username>
  IdentityFile <path to key file (if any)>

Now just type

ssh <name>

to get connected to the server.