Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.