Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- OpenSSH ignores User name set in config file
- Alexander Skwar
August 24, 2011, 12:21 pm
rate this thread
In my ~/.ssh/config, I've got:
When I do a "ssh foo", it tries to connect to 10.20.30.40 using
the username "local". When I remove the "Host *" lines, it tries
to connect with the username "i".
You can find a "ssh -v -v -v foo" output at http://pastebin.com/4YuFD8i4
Why does SSH do that?
I would like SSH to connect to "foo" using the username "i" and
As to why do I have a "Host *" entry: Usually, I need/want to
connect to hosts using the username "local" (yep, l o c a l). This
is *NOT* my local username on my workstation (it's "ask"). But
for some hosts (like the "foo" one there), I'd like to connect using
a different username ("i" in this case). I know that I could of course
use "ssh i@foo", but that doesn't answer the quetion, why the "User"
line seems to be ignored...
ask@ewzw032:~> uname -a
Linux ewzw032 22.214.171.124-0.7-desktop #1 SMP PREEMPT 2011-07-21 02:17:24
+0200 x86_64 x86_64 x86_64 GNU/Linux
ask@ewzw032:~> ssh -V
OpenSSH_5.8p1, OpenSSL 1.0.0c 2 Dec 2010
ask@ewzw032:~> cat /etc/SuSE-brand
VERSION = 11.4
Re: OpenSSH ignores User name set in config file
This is normal regarding how openssh parse its config file: the first option
inside a matching "Host" section "wins" against all next lines with same option
Since the "Host *" matches *every* hostname, "User=local" option will always be
used in your case.
Simply put least specific host sections at the end of the file, like this:
# global catch-all default section
- » command line putty keeps opening up configuration window
- — Previous thread in » Secure Shell Forum
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — Newest thread in » Secure Shell Forum