2014年4月16日水曜日

Login ssh to server without including username

Let's say you want to login to ssh in very short command. For instance,
ssh myserver

How to do it?

No configuration on server, just do some configuration on client side.

On client side terminal, open ssh config file. If it doesn't exists, create a new one.
nano ~/.ssh/config

Then, type in following. 
host myserver
hostname myserverdomain.com
user myuser

And save it. No restart is required, just try ssh myserver, and you are login as myuser@myserverdomain.com