Issue
I have an alias to a server machine:
alias myserver='user@server'
however, I cannot ssh into it by using the alias:
ssh myserver
ssh: Could not resolve hostname myserver: Name or service not known
the alias is correctly set:
myserver
returns bash: user@server: command not found
.
Obviously, it works when I do it extensively:
ssh user@server
what is going on? I am pretty sure it has been working until today... But not sure what I changed. Any help?
Solution
you can either have an Alias in your bash configuration which includes the actual ssh
command aswell ...
alias myserver='ssh user@myserver'
... or have an alias in your ssh config file.
Host myserver
HostName 10.10.20.20
User user
ssh myserver
should work.
A more extensive answer can be found for example here.
Answered By - Uwe