This question is not a duplicate. Please read it before you mark it as such.
Is it possible to assign nicknames or aliases to users on a Linux sever and SSH into the server using the nicknames? I am thinking something along the lines of the aliases for various commands that get added to the .bashrc
or the .bash_aliases
file, e.g.:
alias grep='grep --color=auto'
For example, if there is a requirement (business rule) to set up users on the server with their full name, e.g., john_smith
instead of just their first name (john
) but we want to nickname john_smith
fruitloops
and we want John to be able to:
ssh john_smith@ip_address
as well as:
ssh fruitloops@ip_address
If it is possible, where would the mapping between a user and their nickname be set up? Would the user fruitloops
also need to exists on the sever?
This question is about setting up an alias for a user, not a host.
ssh fruitloop
– Takkat May 24 '17 at 10:19fruitloops
refers to the userjohn_smith
, not the IP address. – dw8547 May 24 '17 at 10:22User fruitloop
line would be for. You can add several entries in one config file. – Takkat May 24 '17 at 10:31I may be able to find some old code along these lines (if I do I'll post as an answer).
– Sumudu Fernando May 24 '17 at 13:21john_adam_smith_brown
but the users don't want to have to type that in everytime they want to SSH into the remote. They want to type something much shorter, like a nickname they chose for themselves or just their first name. Sojohn_adam_smith_brown
would like to SSH in asjon
. – dw8547 May 26 '17 at 08:33alias sshfoo='ssh hanshenrik@foo.com'
– hanshenrik Dec 07 '17 at 22:42