I'm using OpenSSH from a Windows machine to connect to a Linux Mint 9 box. My Windows user name doesn't match the ssh target's user name, so I'm trying to specify the user to use for login using ssh_config
. I know OpenSSH can see the ssh_config
file since I'm specifying the identify file in it.
The section specific to the host in ssh_config is:
Host hostname
HostName hostname
IdentityFile ~/.ssh/id_dsa
User username
Compression yes
If I do ssh username@hostname
it works.
Trying using ssh_config
only gives:
F:\>ssh -v hostname
OpenSSH_5.6p1, OpenSSL 0.9.8o 01 Jun 2010
debug1: Connecting to hostname [XX.XX.XX.XX] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /cygdrive/f/progs/OpenSSH/home/.ssh/id_rsa type -1
debug1: identity file /cygdrive/f/progs/OpenSSH/home/.ssh/id_rsa-cert type -1
debug1: identity file /cygdrive/f/progs/OpenSSH/home/.ssh/id_dsa type 2
debug1: identity file /cygdrive/f/progs/OpenSSH/home/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debia
n-3ubuntu5
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'hostname' is known and matches the RSA host key.
debug1: Found key in /cygdrive/f/progs/OpenSSH/home/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /cygdrive/f/progs/OpenSSH/home/.ssh/id_rsa
debug1: Offering DSA public key: /cygdrive/f/progs/OpenSSH/home/.ssh/id_dsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
I was under the impression that (as outlined in this question: How to make ssh log in as the right user?) specifying User username
in ssh_config
should work.
Why isn't OpenSSH using the username specified in ssh_config
?
ssh
is tryingid_rsa
beforeid_dsa
- meaning it is using the default identity files, not the one you pointed to.ssh_config
file located?ssh_config
would be/cygdrive/f/progs/OpenSSH/etc/ssh_config
as far asssh
is concerned.ssh_config
from there to/cygdrive/f/progs/OpenSSH/home/.ssh/config
fixed it. The question now is what do I do with this question now that it's been shown to be based on incorrect assumptions? Does it make sense to modify this question into "Why isn't OpenSSH using my config file?" and have an answer about how it wasn't in the right place? Or should I look at deleting the question?