Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
passwordless ssh to localhost ?! [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
gen536
n00b
n00b


Joined: 23 Feb 2004
Posts: 35

PostPosted: Tue Dec 07, 2004 9:47 pm    Post subject: passwordless ssh to localhost ?! [solved] Reply with quote

Hi all

I've set up publickey ssh from host1 to host2, creating id_dsa.pub and copying it to host2's authorized_keys2

So that works fine.

But when I copy the same file to host1's authorized_keys2, and try to ssh localhost, I get a password prompt.

Why doesn't this work with localhost ?

(I need to ssh localhost because I've a script that sshes to many hosts, including localhost.)

debug :

host1 is "vador". The user is "neoexport" (same user from and to)

vador .ssh $ ssh -vvvv localhost
OpenSSH_3.8.1p1, OpenSSL 0.9.7d 17 Mar 2004
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/neoexport/.ssh/identity type -1
debug1: identity file /home/neoexport/.ssh/id_rsa type -1
debug3: Not a RSA1 key file /home/neoexport/.ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/neoexport/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_3.8.1p1
debug1: match: OpenSSH_3.8.1p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se, aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se, aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se, aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se, aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
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
debug2: dh_gen_key: priv key bits set: 131/256
debug2: bits set: 538/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /home/neoexport/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 4
debug1: Host 'localhost' is known and matches the RSA host key.
debug1: Found key in /home/neoexport/.ssh/known_hosts:4
debug2: bits set: 514/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/neoexport/.ssh/identity ((nil))
debug2: key: /home/neoexport/.ssh/id_rsa ((nil))
debug2: key: /home/neoexport/.ssh/id_dsa (0x80902d8)
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/neoexport/.ssh/identity
debug3: no such identity: /home/neoexport/.ssh/identity
debug1: Trying private key: /home/neoexport/.ssh/id_rsa
debug3: no such identity: /home/neoexport/.ssh/id_rsa
debug1: Offering public key: /home/neoexport/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug2: we sent a keyboard-interactive packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
neoexport@localhost's password:



Thanks a lot !!

EDIT: Added spaces to a few lines for line wrapping. --pjp


Last edited by gen536 on Tue Dec 07, 2004 11:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
waverider202
Tux's lil' helper
Tux's lil' helper


Joined: 25 Sep 2002
Posts: 146
Location: Drexel University

PostPosted: Tue Dec 07, 2004 9:58 pm    Post subject: guess Reply with quote

I only have a guess. Instead of ssh'ing to localhost.....try ssh'ing to vador. The ssh keys may be keyed to the hostname.
_________________
:-P
Back to top
View user's profile Send private message
gen536
n00b
n00b


Joined: 23 Feb 2004
Posts: 35

PostPosted: Tue Dec 07, 2004 10:09 pm    Post subject: Reply with quote

yeah I tried, same issue :(

vador root $ ssh -v vador
OpenSSH_3.8.1p1, OpenSSL 0.9.7d 17 Mar 2004
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to vador [158.64.24.193] port 22.
debug1: Connection established.
debug1: identity file /home/neoexport/.ssh/identity type -1
debug1: identity file /home/neoexport/.ssh/id_rsa type -1
debug1: identity file /home/neoexport/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_3.8.1p1
debug1: match: OpenSSH_3.8.1p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1
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 'vador' is known and matches the RSA host key.
debug1: Found key in /home/neoexport/.ssh/known_hosts:2
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,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/neoexport/.ssh/identity
debug1: Trying private key: /home/neoexport/.ssh/id_rsa
debug1: Offering public key: /home/neoexport/.ssh/id_dsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
neoexport@vador's password:
Back to top
View user's profile Send private message
irf2003
Veteran
Veteran


Joined: 10 Sep 2003
Posts: 1078

PostPosted: Tue Dec 07, 2004 10:14 pm    Post subject: Reply with quote

the pubkey is to authenticate the server or client.
i would therefore imagine, if you would like login using pk
you should possess the private key with which to sign some
challenge which was sent to you from the server.
shouldn't you also have the private key too?
and even if you did, isn't that encrypted?
not an expert of how ssh utilizes pk's, just guessing
hth


Last edited by irf2003 on Tue Dec 07, 2004 10:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
gen536
n00b
n00b


Joined: 23 Feb 2004
Posts: 35

PostPosted: Tue Dec 07, 2004 10:16 pm    Post subject: Reply with quote

Well I don't know exactly how ssh works.

But when I ssh from host1 to host2, it does work passwordless, so no problem here.

It fails only when connecting to localhost !
Back to top
View user's profile Send private message
irf2003
Veteran
Veteran


Joined: 10 Sep 2003
Posts: 1078

PostPosted: Tue Dec 07, 2004 10:23 pm    Post subject: Reply with quote

gen536 wrote:
Well I don't know exactly how ssh works.

But when I ssh from host1 to host2, it does work passwordless, so no problem here.

It fails only when connecting to localhost !

maybe it does not know what key to use, so specify the target host explicitly
hth
PS if it's passwordless, then this is bad news, as it means that the private
key is not stored in encrypted form, so guard it well
Back to top
View user's profile Send private message
gen536
n00b
n00b


Joined: 23 Feb 2004
Posts: 35

PostPosted: Tue Dec 07, 2004 10:34 pm    Post subject: Reply with quote

what do you mean 'explicitly' ?

You mean 'ssh vador' ? This doesn't work either
Back to top
View user's profile Send private message
gen536
n00b
n00b


Joined: 23 Feb 2004
Posts: 35

PostPosted: Tue Dec 07, 2004 11:14 pm    Post subject: Reply with quote

ok, solved.

I hadn't "usePAM yes" on the local ssh server

Thanks anyway !
Back to top
View user's profile Send private message
Sujao
l33t
l33t


Joined: 25 Sep 2004
Posts: 677
Location: Germany

PostPosted: Fri May 13, 2005 6:49 am    Post subject: Reply with quote

I am not sure if this really solved your problem. I assume that using PAM just overrides the settings in /etc/ssh/sshd_config so that your "wrong" settings are simply ignored. Correct me if I am wrong, since I have the same problem.
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Fri May 13, 2005 7:03 am    Post subject: Reply with quote

irf2003 wrote:
PS if it's passwordless, then this is bad news, as it means that the private
key is not stored in encrypted form, so guard it well

You should mention that an ssh-agent started by keychain is the correct way of going about this (you only type the password once per reboot).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum