Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

When I ssh between different pcs I can omit my username (tom) and just type

ssh pc_name

instead of

ssh tom@pc_name

I like this feature, and have got into the habit of using it.

Unfortunately, on one of my computers I went for the user name tommy. Everytime I connect to this computer I forget to write tommy@creative_pc and wonder why my password doesn't work. Is there a way to tell ssh what user name to use when the username is omitted?

Edit: Just found the following question that is similar: How to make ssh log in as the right user? It didn't come up on my initial search.

share|improve this question

marked as duplicate by Heptite, Tog, Dave, Excellll, Kevin Panko Apr 1 '14 at 0:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 19 down vote accepted


$ ssh -l tommy

will log you in as tommy.

You can also make this persistent per-host by having a record like this in ~/.ssh/config:

Host creative_pc
User tommy
HostName creative_pc # put the full host name here or the IP if it is static

then you just do:

$ ssh creative_pc # this is the string from Host setting

and you login there as tommy by default

share|improve this answer
Perfect response. @Tom - if you want more info, this is discussed in the ssh man page: – Doc Jul 4 '11 at 15:16
Ace, I knew there must be a way. thanks! – Tom Jul 4 '11 at 15:20
For those of you wanting a default login-user for ALL remote servers. Use '*' as Host wildcard (Host *). – Langusten Gustel May 23 '13 at 15:43
For myself, I have a single User line in the file and this set it globally. No Host required. – Robert Jun 24 '13 at 17:45

I have a large list of servers, so I used a shell alias to set a default user for all hosts. Put bellow line on your ~/.bashrc:

alias ssh="ssh -l default_user"

You can still set another user, using -l:

ssh server -l other_user

I started using today, seems working fine on Ubuntu 12.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .