Building a useful .ssh/config file for your SSH connections | setup to configure your .ssh/config file!

Writing a good ssh config file can make your life a whole lot easier especially if your an Linux Admin.

I have written a basic config file below which should be saved in the following location “~/.ssh/config”, when attempting to ssh its the first place SSH looks for instructions by default.

After the config if will go through in detail explain what each line does.

Host: this is like an alias, it will once you attempt to ssh to it, it will resolve using the Hostname field.

Hostname: Look above

Port: The port the ssh server is running on

User: the username you have on the server

Identityfile: This is your SSH private key location

ForwardX11: This is to allow you to see an X GUI session from the remote computer.

Keepalive: the next three are to enable keepalive which will ensure your SSH session stays active even after a period of inactivity. The two subsequent options enable you to configure the frequency of the keepalive packets.

Compression: this enables compression, this is especially useful over slow links. You will need to do more research for the senario which suits your connection and security requirements.

DynamicForward: This enables you to tunnle your connection to the remote host on the specified port. Simply setup your browser on socks5 proxy and point to localhost:port.

LocalForward: This enables you to setup tunneling. Simply specify your local reserved port and your remote IP and port which you want tunneled.

Leave a Reply

Your email address will not be published. Required fields are marked *