August 11, 2010

SSH Login using config

Posted by: {authorName}

Using our example from my previous blog, open console and run the following command:

[happy@mars ~] vim .ssh/config

Hit 'i' and type in the following:

Host jup
User happy
HostName jupiter

Hit esc button then type ':x" to save.

You can now just type:

[happy@mars ~] ssh jup

SSH command will read your config file and match up 'jup' from the Host in your config and use the User and Hostname to connect to another computer.

This is very useful specially if you have many servers that you manage and have different user names and parameters when connecting. You can set all possible parameters for ssh in the config file instead of typing them one by one. Examples are Port if the other computer uses a port other than 22, ForwardX11 to display GUI on your local computer, Protocol to force ssh protocol version, Tunnel for tunneling and many others. Type "man ssh_config" in your console to get more in depth information about possible parameters.

Comments

blog comments powered by Disqus