Page 1 of 1
SSH login without password using DSA key
Posted: 17 May 2007, 16:26
by yodanski
Hi all,
I can't get it to work. Here's what I did :
- mkdir .ssh in ~/ on Bubba.
- copied id_dsa.pub from macbook to bubba in ~/.ssh/
and renamed it to authorized_keys
Bubba still asks for a password.
What did I do wrong?
Cheers,
Dennis.
Posted: 17 May 2007, 16:41
by bjorn
Hi!
depends on what you mean, do bubba ask for "password" or for "Enter passphrase for key '<path_to_key>'"?
if only "password"
make sure you have your private key in your .ssh/ directory of your macbook (eg. ~/.ssh/id_dsa)
if "enter passphrase"
eighter regenerate a new key without password (i would NOT recommend this), or set up a keychain that enable you to only enter a password for the key once per session.
If you need more help we need more info on your setup
/Bjorn
Posted: 17 May 2007, 17:53
by yodanski
Hi, thanks
Bubba asks me for a password.
The key was generated without a passphrase.
id_dsa is indeed in ~/.ssh on my Macbook Pro...
I have the feeling that I have to edit the sshd_config on Bubba...
I'm not really sure.
I'm running OSX 10.4.9 on a Macbook Pro
Bubba is hooked up to a Draytek Vigor 2600plus.
Bubba seems to have the latest software.
If you need to know more, let me know.
Bye!
Posted: 17 May 2007, 18:23
by yodanski
Hi, here's what I get doing a ssh -v :
debug1: Reading configuration data /Users/***/.ssh/config
debug1: Applying options for bubba
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to ***.***.*.** [***.***.*.**] port 22.
debug1: Connection established.
debug1: identity file /Users/***/.ssh/id_rsa type -1
debug1: identity file /Users/***/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_3.8.1p1 Debian-8.sarge.4
debug1: match: OpenSSH_3.8.1p1 Debian-8.sarge.4 pat OpenSSH_3.*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.5
debug1: An invalid name was supplied
Cannot determine realm for numeric host address
debug1: An invalid name was supplied
Cannot determine realm for numeric host address
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc 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 '***.***.*.**' is known and matches the RSA host key.
debug1: Found key in /Users/***/.ssh/known_hosts:4
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/***/.ssh/id_rsa
debug1: Offering public key: /Users/***/.ssh/id_dsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
Password:
debug1: Authentications that can continue: publickey,keyboard-interactive
Password:
Posted: 18 May 2007, 02:42
by bjorn
hi again,
that's strange... i'm running linux->bubba and that works perfectly both with and without passphrase. I did some quick search on google for your errormessage:
"debug1: An invalid name was supplied
Cannot determine realm for numeric host address "
and it seems that a lot of folks have that kind of problems with Mac osx, didn't spend all that much time looking for an answer since i don't have a mac to verify for myself.
it's clear that your client IS offering the key for auth, but server seem to reject it.
someone suggested setting GSSAuthentication to NO and someone else suggested regenerating hostkeys (eg ssh_host_dsa key and ssh_host_rsa_key).
do you get any errors on bubba, for example /var/log/auth or /var/log/messages?
otherwise, i'm out of ideas for now.
/Bjorn
Posted: 18 May 2007, 05:40
by yodanski
Hi,
Thanks for directing me to the log.
I think it's a permission issue. This is what caught my eye:
May 17 23:56:54 bubba sshd[6240]: Authentication refused: bad ownership or modes for directory /home/******/.ssh
So I logged into Bubba and checked the .ssh directory, I get
drwxrwxrwx
Strange...
Dennis.
Posted: 18 May 2007, 06:18
by bjorn
ah!
chmod -R 700 ~/.ssh/
should do the trick then!
Posted: 18 May 2007, 06:38
by yodanski
Yes!
Thanks! Learned something again today.
It's interesting to see that this only works when permissions
are set for me - and not anyone else. Is this a result of how
SSH is set up you think?
Thanks again.
My next topic in the forum is :
installing rsync on Bubba...
Dennis.
Posted: 18 May 2007, 06:45
by bjorn
it's default behaviour of sshd.
read "man sshd_config", especially on the option "StrictModes".
btw, i would really recommend you to make practice of NOT using an empty passphrase for your keys!
Read up on ssh-agent and how to use keychains instead!
/Bjorn
Posted: 18 May 2007, 06:51
by yodanski
Ok,
I will do that.
Cheers
Posted: 18 May 2007, 07:03
by yodanski
StrictModes
Specifies whether sshd(8) should check file modes and ownership
of the user's files and home directory before accepting login.
This is normally desirable because novices sometimes accidentally
leave their directory or files world-writable. The default is
``yes''.
Well, the novice - that's me!