TECHIES WORLD

For Techs.... Techniques.... Technologies....

AWSBashCpanelLinux

How to configure SSH alias using config file

SSH alias will be helpful while dealing with multiple systems as there no need to remember all hostnames/ip addresses.

This article explains the steps to configure SSH alias using config file.

Step1: Open default SSH client configuration file "~/.ssh/config".

#vi ~/.ssh/config

Step2: Update the server details to this file in the following format.

Host webserver
    HostName 192.168.10.1
    User root
    IdentityFIle ~/.ssh/Key-file
    Port 22

Host dbserver
    HostName 192.168.10.2
    User root
    IdentityFIle ~/.ssh/Key-file
    Port 22

Here the values Host, Hostname, User, Key-file and Port need to be replaced according to the required environments.

Now we can able to use the aliases for ssh in the following way.

#ssh webserver

#ssh dbserver

Please note that this alias is available only for the current user. If you want to make the aliases available for all users, do the same configurations in /etc/ssh/ssh_config file.

That's all…

Leave a Reply