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
Host foo
  HostName foo.com
  User specialuser
  IdentityFile /Users/XXX/.ssh/id_rsa

Host *
  User defaultuser

On most machines, my UNIX login user name is XXX. But on one particular machine, it is YYY, how to modify this above .ssh/config file so it can work on all machines?

share|improve this question
up vote 0 down vote accepted

Try using the %u escape sequence, which expands to the current user's username:

Host foo
HostName foo.com
User specialuser
IdentityFile /Users/%u/.ssh/id_rsa

Host *
User defaultuser

Read under the IdentityFile section in man ssh_config for other escape sequences.

share|improve this answer

You must log in to answer this question.

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