Richard Julian


richard [at]

SSH Client Guide : The Config File

27 Jul 2014

Now that we know all of these cool client commands , let us make our lives so much easier by setting up a client config file so we don’t have to type in all of those nasty options.


Regularly sshing to a machine? You likely want an ssh config file. This can be stored in /etc/ssh/ssh_config  (universal) or ~/.ssh/config (local user).

Let’s say you regularly log in to a remote server with a nonstandard port (29503) and using a public key.

Host webserver


User username

Port 29503

IdentityFile ~/.ssh/key_file

You would now ssh with those options by typing ssh webserver . This is equivalent to ssh **-p 29503 -i ~/.ssh/key_file**. Even in simple configurations, having a config file can save you from a fair bit of typing, if you’ll be regularly connecting.


SSH config files also can set default options using the asterisk as a wildcard character:


Port 22

User richard

ForwardX11Trusted yes

This would allow us to put the default port for all ssh connections at 22, username richard, and allow X11 forwarding. These can be overwritten on the command line (with explicit declaration) or by further entries in your config file.


Check out all of the config file options to customize and save time with your ssh client at the ssh_config manpage!