Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-08-2012
Registered User
 
Join Date: May 2012
Location: Puerto Rico
Posts: 37
Thanks: 14
Thanked 0 Times in 0 Posts
Data SSH Keys Authentication keeps asking for password

Hi!

Im trying to set access from ServerA(SunOS) to ServerB(Some custom Linux with Keyboard Interactive login) with SSH Keys. As a proof of concept I was able to do it between 2 virtual machines. Now in my real life scenario it isnt working.

I created the keys in ServerA, copied them to ServerB, chmod'd .ssh folders to 700 on both ServerA,B.

For me *it seems* its working, but at the end it still falls back to Keyboard Interactive. Here is the log of what I get.


Code:
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /xxx/.ssh/identity type -1
debug1: identity file /xxx/.ssh/id_rsa type 1
debug1: identity file /xxx/.ssh/id_dsa type -1
debug1: Logging to host: xxx.xxx.xxx.xxx
debug1: Local user: xxx Remote user: xxx
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.2
debug1: match: OpenSSH_4.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-Sun_SSH_1.1.4
debug1: use_engine is 'yes'
debug1: pkcs11 engine initialized, now setting it as default for RSA, DSA, and symmetric ciphers
debug1: pkcs11 engine initialization complete
debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible
Unknown code 0
)
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: Peer sent proposed langtags, ctos:
debug1: Peer sent proposed langtags, stoc:
debug1: We proposed langtags, ctos: en-US
debug1: We proposed langtags, stoc: en-US
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: dh_gen_key: priv key bits set: 125/256
debug1: bits set: 1039/2048
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'XXX.XXX.XXX.XXX' is known and matches the RSA host key.
debug1: Found key in /XXX/.ssh/known_hosts:1
debug1: bits set: 1061/2048
debug1: ssh_rsa_verify: signature correct
debug1: newkeys: mode 1
debug1: set_newkeys: setting new keys for 'out' mode
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: newkeys: mode 0
debug1: set_newkeys: setting new keys for 'in' mode
debug1: SSH2_MSG_NEWKEYS received
debug1: done: ssh_kex2.
debug1: send SSH2_MSG_SERVICE_REQUEST
debug1: got SSH2_MSG_SERVICE_ACCEPT
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /XXXX/.ssh/identity
debug1: Trying public key: /xxx/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /xxx/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
Password:

Why it still asks for my password?

Thanks in advance
Sponsored Links
    #2  
Old 06-08-2012
hergp's Avatar
hergp hergp is offline Forum Advisor  
Problem Eliminator
 
Join Date: Jan 2010
Location: Vienna, Austria
Posts: 621
Thanks: 10
Thanked 124 Times in 115 Posts
Are there any helpful messages in /var/log/secure (or another logfile where auth messages are written to) on the target system?

Are the permission bits of ~/.ssh on the target system equal to rwx------ (0700)?

If SELinux is active on the target system, is the label of the ~/.ssh directory equal to ssh_home_t (use "ls -Zd ~/.ssh" to find out)?
Sponsored Links
    #3  
Old 06-08-2012
Registered User
 
Join Date: May 2012
Location: Puerto Rico
Posts: 37
Thanks: 14
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by hergp View Post
Are there any helpful messages in /var/log/secure (or another logfile where auth messages are written to) on the target system?

Are the permission bits of ~/.ssh on the target system equal to rwx------ (0700)?

If SELinux is active on the target system, is the label of the ~/.ssh directory equal to ssh_home_t (use "ls -Zd ~/.ssh" to find out)?
There are no helpfull messages, it doesnt even have a /secure folder. I tried cheking a few files around /log but it was useless...

The permissions are all Ok.

The target system is a propietary custom linux the -Zd command didnt work.
    #4  
Old 06-08-2012
hergp's Avatar
hergp hergp is offline Forum Advisor  
Problem Eliminator
 
Join Date: Jan 2010
Location: Vienna, Austria
Posts: 621
Thanks: 10
Thanked 124 Times in 115 Posts
Hmm, some more ideas:

Is the public key in ~/.ssh/authorized_keys on the target system written as a single line? Because keys are long strings, sometimes they are pasted as multiple lines instead of a single one. Happened to me several times.

Is public key login disabled in /etc/ssh/sshd_config on the target system (look for PubkeyAuthentication )?

Try to connect using a higher debug level, like ssh -vv or even ssh -vvv . Maybe something useful comes up.
The Following User Says Thank You to hergp For This Useful Post:
RedSpyder (06-08-2012)
Sponsored Links
    #5  
Old 06-08-2012
Registered User
 
Join Date: May 2012
Location: Puerto Rico
Posts: 37
Thanks: 14
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by hergp View Post
Hmm, some more ideas:

Is the public key in ~/.ssh/authorized_keys on the target system written as a single line? Because keys are long strings, sometimes they are pasted as multiple lines instead of a single one. Happened to me several times.

Is public key login disabled in /etc/ssh/sshd_config on the target system (look for PubkeyAuthentication )?

Try to connect using a higher debug level, like ssh -vv or even ssh -vvv . Maybe something useful comes up.
using -vv


Code:
 Next authentication method: publickey
debug1: Trying private key: /xxx/.ssh/identity
debug1: Trying public key: /xxx/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /xxx/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug1: Next authentication method: keyboard-interactive

Sponsored Links
    #6  
Old 06-08-2012
hergp's Avatar
hergp hergp is offline Forum Advisor  
Problem Eliminator
 
Join Date: Jan 2010
Location: Vienna, Austria
Posts: 621
Thanks: 10
Thanked 124 Times in 115 Posts
Doesn't look like much. You sent a RSA key to the target host, but it didn't like it. Try ssh -vvv too.

If that does not reveal anything useful, you have to make your sshd on the target machine write to syslog. Check SyslogFacility and LogLevel in /etc/ssh/sshd_config and verify, that the syslog messages are actually written somewhere (check /etc/syslog.conf). Can't say much more considering the fact you have some sort of custom linux.
The Following User Says Thank You to hergp For This Useful Post:
RedSpyder (06-08-2012)
Sponsored Links
    #7  
Old 06-08-2012
Registered User
 
Join Date: May 2012
Location: Puerto Rico
Posts: 37
Thanks: 14
Thanked 0 Times in 0 Posts
First of all thanks a lot hergp for your help. I finally figured out what was happening.

Problem was that I didnt have the following keys enabled in the sshd_config file:


Code:
RSAAuthentication yes
PubKeyAuthentication yes
AuthorizedKeysFlle %h/.ssh/authorized_keys

Besides that, since I didnt have
Code:
ssh-copy-id

command I had to manually paste the key in ServerB. That made it interpret the key as 3 separate lines.

To solve this, in case you cant use ssh-copy-id. Paste the first line of your key WITHOUT the last 2 characters, then type yourself the missing characters from line 1 and the first one from line 2, this will prevent adding a "new line" between the first and second line of the key. Repeat with the 3d line
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
openssh 5.3 needs password vs. 4.3 using private keys epoins UNIX for Advanced & Expert Users 4 01-11-2012 05:52 AM
ssh keys - no password prompt from AIX to RPA omonoiatis9 AIX 9 12-20-2011 02:22 AM
SSH Prompts for Password After Keys Setup Successfully Rynok Red Hat 3 06-28-2009 03:51 PM
SSH with RSA keys - error contacting the authentication agent sandeeppotdar UNIX for Dummies Questions & Answers 2 01-10-2009 10:47 PM
Password Authentication juan_o_morillo Security 3 08-07-2001 12:37 PM



All times are GMT -4. The time now is 04:11 PM.