ssh publickey authentication -> centOS doesn't work

Support for security such as Firewalls and securing linux
Post Reply
valus
Posts: 2
Joined: 2005/06/13 06:47:57
Location: Slovak republic

ssh publickey authentication -> centOS doesn't work

Post by valus » 2005/06/16 12:15:56

Hi people,

I have on my notebook centOS4.0 and OpenSSH_4.1p1, OpenSSL 0.9.7g Apr 2005. Why I can connect to my notebook only with this command

ssh -o PreferredAuthentications=password test@172.21.200.124

I have generated on client PC dsa-key and redistributed publickey from the PC, which I want to connect to my notebook , but publickey authentication doesn't work and connection is closed by my notebook. On the PC is the same version of openssh and openssl and os redhead 9.

Here is a statement, if want to connect to my notebook with publickey auth:

[sacon@ttt sacon]$ ssh -vvv test@172.21.200.124
OpenSSH_4.1p1, OpenSSL 0.9.7g 11 Apr 2005
debug1: Reading configuration data /usr/etc/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to 172.21.200.124 [172.21.200.124] port 22.
debug1: Connection established.
debug1: identity file /home/sacon/.ssh/identity type -1
debug3: Not a RSA1 key file /home/sacon/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'Proc-Type:'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'DEK-Info:'
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
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/sacon/.ssh/id_rsa type 1
debug3: Not a RSA1 key file /home/sacon/.ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'Proc-Type:'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'DEK-Info:'
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/sacon/.ssh/id_dsa type 2
debug1: Remote protocol version 1.99, remote software version OpenSSH_4.1
debug1: match: OpenSSH_4.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.1
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-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-group14-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: 127/256
debug2: bits set: 515/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /home/sacon/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug1: Host '172.21.200.124' is known and matches the RSA host key.
debug1: Found key in /home/sacon/.ssh/known_hosts:1
debug2: bits set: 490/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/sacon/.ssh/identity ((nil))
debug2: key: /home/sacon/.ssh/id_rsa (0x85d4f20)
debug2: key: /home/sacon/.ssh/id_dsa (0x85d4f38)
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/sacon/.ssh/identity
debug3: no such identity: /home/sacon/.ssh/identity
debug1: Offering public key: /home/sacon/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering public key: /home/sacon/.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
Connection closed by 172.21.200.124
-------------------------------------------------------------------------

---------------------
Config on my notebook:
---------------------

[root@hwcon4 test]# more /etc/ssh/sshd_config

Protocol 2
SyslogFacility AUTHPRIV
GSSAPIAuthentication no
UsePAM yes
Subsystem sftp /usr/libexec/openssh/sftp-server

----------------------------------------------------------------------------

I can connect from my notebook to the PC without problem with publickey authentication and I have the same sshd_config and ssh_config on both computers. I have suspicion that this is caused by centOS and not by ssh. Can anyone help?

Thanks

Valus

greatguangong
Posts: 18
Joined: 2005/04/03 15:38:04
Contact:

ssh publickey authentication -> centOS doesn't work

Post by greatguangong » 2005/06/20 08:29:28

can you turn on LogLevel DEBUG and check /var/log/messages for a wealth of info that might let you pinpoint what went wrong where.

or you can post that here...

jallen
Posts: 1
Joined: 2005/06/26 09:20:13
Location: Dublin, Ireland
Contact:

Re: ssh publickey authentication -> centOS doesn't work

Post by jallen » 2005/06/26 09:31:26

I had the same problem, and it was quite simply that the .ssh directory had the wrong permissions.
Pity CentOS does not create a .ssh directory when you create a user. (Mandriva does)

Any of the following modes will work. Basically the directory must not be writeable by group, or other.
When you create the .ssh the default perms are -drwxrwxr-x

chmod u+rwx,og,+rx-w ~/.ssh
chmod 755 ~/.ssh
chmod 700 ~/.ssh

Now it works flawlessly

Post Reply

Return to “CentOS 4 - Security Support”