Logging into SSH with a different username

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.


Posted

in

, , ,

by

Tags:

Comments

3 responses to “Logging into SSH with a different username”

  1. Michael Smith Avatar

    Great tip! This has bothered me for ages! Thanks 🙂

  2. Jay Avatar
    Jay

    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.

  3. Michael Hendrickx Avatar

    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 Reply

Your email address will not be published. Required fields are marked *