Last Updated: February 25, 2016
· goranhalusa

Equivalent of /etc/hosts File for Individual Users

I really like the ability to set up aliases in an /etc/hosts file. However, I’ve always wanted the same functionality when logged in as a regular user. (One can only edit the /etc/hosts file if root or with sudo permissions.)

Through a little research, I found it’s possible. Here are the steps:

vi ~/.ssh/config


Host myalias
Hostname my.real.hostname
User myusername

Save and close (shift + ZZ)

Set the permissions:

chmod 600 ~/.ssh/config

Test it:

ssh myalias