Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-07-2008, 04:01 PM
|
#1
|
|
Member
Registered: Nov 2003
Posts: 703
Rep:
|
ssh prompts for password even though public and private keys have been generated
Hi there --
I am trying to get a particular user account to be able to connect via ssh to another system by using rsa public and private keys.
The first thing I did was run the following command as the user in question, and made sure to have a null password:
The public and private keys were created in the appropriate directory.
The next step I did was to run the command shown below to copy the public key of the user to the remote system:
Quote:
|
$ ssh user@remotehost “cat >> ~/.ssh/authorized_keys” < ~/.ssh/id_rsa.pub
|
After that was done, I connected to the remote system as the user, but I was still prompted for a password. It should be noted that the root account has a similar setup between the two machines, and it can connect using this method without a problem.
What do I need to do to correct this? Thanks.
|
|
|
|
05-07-2008, 04:04 PM
|
#2
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,711
|
the usual suspect is the remote .ssh folder not having rights of 600, as it implicitly undermines the security logic.
|
|
|
|
05-07-2008, 04:10 PM
|
#3
|
|
Member
Registered: Nov 2003
Posts: 703
Original Poster
Rep:
|
Hi there --
Thanks for your reply. I changed the settings of the remote .ssh folder to 600, and then restarted the remote system's ssh server. Unfortunately, that did not help matters.
|
|
|
|
05-07-2008, 04:13 PM
|
#4
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,711
|
OK, so let's check the output of the ssh client with a couple of extra -v's in the command.
|
|
|
|
05-07-2008, 04:17 PM
|
#5
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,711
|
you might also like a tool like ssh-copy-id which should ensure a key is copied to a remote server correctly.
|
|
|
|
05-07-2008, 04:19 PM
|
#6
|
|
Member
Registered: Nov 2003
Posts: 703
Original Poster
Rep:
|
Hi there --
Here is the output that is generated when connecting in verbose mode:
Quote:
{localhost}[1] ssh -v sdc@<remote ip>
OpenSSH_4.2p1, OpenSSL 0.9.7f 22 Mar 2005
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to <remote ip> [<remote ip>] port 22.
debug1: Connection established.
debug1: identity file /export/home/sdc/.ssh/id_rsa type 1
debug1: identity file /export/home/sdc/.ssh/id_dsa type -1
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-OpenSSH_4.2
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 '<remote ip>' is known and matches the RSA host key.
debug1: Found key in /export/home/sdc/.ssh/known_hosts:3
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,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: An invalid name was supplied
Unknown code krb5 243
debug1: An invalid name was supplied
Unknown code krb5 243
debug1: Next authentication method: publickey
debug1: Offering public key: /export/home/sdc/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Trying private key: /export/home/sdc/.ssh/id_dsa
debug1: Next authentication method: password
sdc@<remote ip>'s password:
|
The Unknown code errors also occur with the root account, but it successfully connects to the remote host.
|
|
|
|
05-07-2008, 04:57 PM
|
#7
|
|
Member
Registered: Nov 2003
Posts: 703
Original Poster
Rep:
|
Hi there --
I used the ssh-copy-id utility to see if that would help. I deleted the original .ssh directory on the remote system to allow the creation of a new one. I ran the command as the user in question on the local system, and it did appear to create the directory on the remote system. One thing I did notice: the permissions were set to 700 as opposed to 600.
I first connected with the permissions left as they were, and I was prompted for a password. I then changed the permissions to 600, and connected once more, but was still prompted for the password.
One other item of note: when the permissions on the .ssh directory were set to 600, the user in question could NOT change, or cd, into it even though the user is the owner of the directory. Only root could get into it.
Your thoughts?
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:13 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|