Logging into SSH with a different username

Posted by Michael Hendrickx on March 26, 2009
misc, security, sysadmin, web

I love SSH. SSH is the de-facto service for remote server management, especially in a CLI environment.

Being a avid Linux user, and spending quite a bit of time on OSX lately, I often SSH into several servers remotely. Being subject to “username conventions”, you don’t always share the same username across machines. And I always wondered how one could just type ssh hostname instead of providing the username.

Seems that, by creating a .ssh/config file with following contents:


Host server.example.com server
  User username

WIll make life easier, as you can in the future only do a “ssh hostname”. I didn’t know this.

3 Comments to Logging into SSH with a different username

Michael Smith
March 26, 2009

Great tip! This has bothered me for ages! Thanks :)

Jay
March 26, 2009

Using this feature for some time now, nice to use when there is no DNS mapping for the host or when it’s listening on a different port.

Michael Hendrickx
March 26, 2009

Hi Jay, cool. I didn’t know about this. I usually just used the keys, for not typing passwords.. but was always bothered with typing “user@host”.. ;)

Leave a comment

WP_Big_City