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.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Host myhost Hostname 10.1.1.1 Port 2222 User uname IdentityFile ~/.ssh/github.key ForwardX11 yes Keepalive yes ServerAliveInterval 30 ServerAliveCountMax 120 Compression yes Cipher Blowfish DynamicForward 8999 LocalForward 1521 10.1.1.99:1521 |
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.