Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I would like to connect to each server using the root user and to machin server using me user.

I edit .ssh/config

 User root
 Host machin
 Hostname machin
 User me

When I type

 ssh machin

I get

 root@machin's password:

What is wrong with my config?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

According to the ssh_config manual page:

Since the first obtained value for each parameter is used, more host-specific declarations should be given near the beginning of the file, and general defaults at the end.

You should change the order of your configuration values, first set the host-specific ones then the general ones:

Host machin
Hostname machin
User me
User root
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.