Following steps for Connecting to Remote Host via Alias Name Using SSH Config File.
All below steps have to be executed on Linux host from which you want to connect to remote server using alias name
NOTE: Please note that below steps can also be applied on MacBook Mac OS terminal as well.
1) create config file inside .ssh folder of user home.
mkdir ~/.ssh/config
2) Edit the ~/.ssh/config file as follows:Host <alias name>
HostName <IP/hostname>
User <username>
ProxyCommand nc -X connect -x <proxy> %h %p
ServerAliveInterval <internal>
- <alias name> with the alias name you want to use to server you want to connect for e.g. testmachine
- <IP/hostname> with the hostname/ip of remote server for e.g. 10.10.10.10
- <Username> with the username of the remote server for e.g. appuser
- <proxy> replace it with the proxy details if any. If no proxy you can remove this line.
- <internal> with the ServerAliveInterval in seconds. You can skip this flag as well.
There may be other additional SSH settings as well you can place inside config file. Above are just few examples.
3) Now connect to the remote server using alias name as follows. Replace <alias name> with the alias name you set in config file.
ssh <alias name>
No comments:
Post a Comment