Dear all,
I have a machine with IP 192.168.0.59 with the user named igpadmin.
another machine with IP 192.168.0.11 with the user iv2user, postgres and repository I want to login from 192.168.0.59 to in these user accounts without prompting for the password.

I have generated generated keys and copied to user account's .ssh directory in file 'authorized_keys and face no problem while logging to the account of i2user and postgres , I directly get into their account without prompting for the passwd.

But whenever I typed command from 192.168.0.59 as below,
$ ssh -i ~/.ssh/id_rsa repository@192.168.0.11
I get prompt to input the password.
What may be the reason for the same.

I checked /etc/.ssh/sshd_config file, recopied the public key to repostory's .ssh/authorized_keys file resatrted the daemon but didn't get success .

Please guide me what may be the reason.
Regards
Vinod

hi,

there must be a problem with your authorised keys file, or your sshd_config file. What happens if you try and ssh from 192.168.0.59 to 192.168.0.11 whilst logged on as repository. If it doesnt allow you then it looks like an error in one of the two files. Have you got AllowedGroups enabled in sshd and is the group that repository belongs to on that list.

hi,

there must be a problem with your authorised keys file, or your sshd_config file. What happens if you try and ssh from 192.168.0.59 to 192.168.0.11 whilst logged on as repository. If it doesnt allow you then it looks like an error in one of the two files. Have you got AllowedGroups enabled in sshd and is the group that repository belongs to on that list.

Hi,
I have checked both the files , their permission and ownerships. But everythings seems ok
In my /etc/ssh/sshd_config file on server i.e. 192.168.0.11 , I have already made entry
AllowUsers iv2user repository postgres
And I am able to do passwordless ssh to iv2user and postgres.
As you suggested I tried adding one more line for the group of which repository is the member
AllowGroups repository
Started daemons and again tried from my client machine but still it gives error.
If required should I send you my debugging output.
Please suggest.
Thanks

hi,

yer the debug output would be good. If you go into sshd_config and set the Debug level to 3. And then ssh from server to client as all users and output the debug information to here.

Also in the first post you said the different users you had on the different servers. Can you confirm this please. If you want to ssh from one server to another as a certain user then the user must exist on both servers or they must share the same password group and shaddow file eg using nis. You can do this by cating the passwd file in /etc/passwd on both servers and then outputin the command to here.

hi,

yer the debug output would be good. If you go into sshd_config and set the Debug level to 3. And then ssh from server to client as all users and output the debug information to here.

Hi,
I have tried other way also on my local system i.e. 192.168.0.59 as a "root" and I have generated the keys and followed procedure for passwordless ssh to user on the server. Here also I am successeful for user "iv2user" and "postgres" but still problem persist for the specifc user named "repository".
Please find herewith my debug output
# ssh -vvv -i ~/.ssh/id_rsa -l repository 192.168.0.11
<<<<<<<<<<<This is the output>>>>>>>>>>
OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.11 [192.168.0.11] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug3: Not a RSA1 key file /root/.ssh/id_rsa.
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
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 /root/.ssh/id_rsa type 1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH_3.*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
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,arcfour128,arcfour256,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,arcfour128,arcfour256,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@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,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: 125/256
debug2: bits set: 523/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /root/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 5
debug1: Host '192.168.0.11' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:5
debug2: bits set: 505/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: /root/.ssh/id_rsa (0x896b388)
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-with-mic,password
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup gssapi-with-mic
debug3: remaining preferred: publickey,keyboard-interactive,password
debug3: authmethod_is_enabled gssapi-with-mic
debug1: Next authentication method: gssapi-with-mic
debug3: Trying to reverse map address 192.168.0.11.
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: An invalid name was supplied
Cannot determine realm for numeric host address

debug2: we did not send a packet, disable method
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /root/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
repository@192.168.0.11's password:

debug3: Not a RSA1 key file /root/.ssh/id_rsa.
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
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'

This would appear to be your issue, you stated that you generated RSA keys previously, but based on the error above, why is there an SSL based key in this file?

RSA and SSL keys are much different, at this point I would recommend just deleting the id_rsa id_rsa.pub and re-creating the RSA key.

hi thats a good place to start you clearly dont have a rsa key in the correct place. If that doesnt work then can you please show the output of you /etc/passwd file. Also have you tried just typing the following command to see if it works:

ssh -p22 repository@192.168.0.11

It looks like it is looking for the rsa key in /root/.sshd/id_rsa which is wrong and it doesnt need to do.

debug3: Not a RSA1 key file /root/.ssh/id_rsa.

just was wondering whether you have managed to solve your problems or not???

I followed the instruction , generated new keys , copied pub key to server side users iv2user, postgres, repostory. And able to ssh to iv2user and postgres but still problem for repository and the same message.
I have edited authorized_keys file of user repository , deleted old key and appended new key, rechecked file permission and ownership

This authorized_keys file have other entries too so I cann't delete it , should I keep only one entry of my machine and try it again? For testing purpose.
Any guess
Thanks for your help

can i have the output for the /etc/passwd file and the /etc/group files for both machines. Also can you give me the debug info for this command

ssh -p22 repository@192.168.0.11

One reason I've found for PK SSH to not work is file permissions. Make sure repository's .ssh directory is 'chmod 700' and the contents within it are 'chmod 600'. If there's any possibility that a private key could have been compromised, SSH will fail that method of authentication.

N

while copying and generating the keys remember you can not generate key for different user you will only be able to generate the authorized keys only for current user though which u r logged in..

yer i didnt think of that the files are locate in the users home directory in the .ssh/knownhosts file if you have trouble finding them!

yes autherized_keys has to be located in $HOME/.ssh/ directory ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.