Sometimes I find annoying having to write the username and host when connecting trough SSH. Specially when the host name is very long and easy to forget.
But that is very easy to fix, we just need to create an alias for each host in the file /home/YourUserName/.ssh/config
Creating Alias
Create the file config if it doesn’t exist:
sudo touch ~/.ssh/config
Edit the file:
sudo nano ~/.ssh/config
And now just add the hosts:
Host host1 HostName address.to.my.host1 User YourUserName Host host2 HostName address.to.my.host2 User YourUserName
Test it!
That’s it, we can now connect trough ssh just using the alias host1 or host2:
ssh host1
ssh host2
Much nicer than using the annoying whole string:
ssh YourUserName@address.to.my.host1
ssh YourUserName@address.to.my.host2