My last blog, which discussed how you can login via ssh without entering a password, makes your life easier as you don't have to remember each and every password on every single computer. Not to mention, it ensures greater security as you are accessing the other computer with a key which only you have access to.
This time I'll make ssh login even easier by using a config file.
Instead of typing ssh with different arguments plus the long domain name or IP address and user name, you'll just need to type the command "ssh myserver".
This time I'll make ssh login even easier by using a config file.
Instead of typing ssh with different arguments plus the long domain name or IP address and user name, you'll just need to type the command "ssh myserver".
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, especially if you have many servers that you manage and have different usernames 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