SSH prompts password for non identical users


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users SSH prompts password for non identical users
# 1  
Old 06-01-2008
SSH prompts password for non identical users

host1 & host2 : Solaris 10 - SPARC server


From host1 able to ssh to host2 as same user with out password prompt. But, when ssh to different user in

host2, it prompts for password

DETAILS
=======

In host1:

1) logged as root
2) ssh-keygen -t dsa -b 1024 (no pass phrase)
3) Ensured that permission for /.ssh is 700 & for id_dsa is 600
4) copied id_dsa.pub to host2 : /.ssh

In host2:

1) logged as root
2) cp /.ssh/id_dsa.pub /.ssh/authorized_keys
3) Ensured that permission for /.ssh is 700 & for authorized_keys is 644


From host1:

1) Login as root
2) ssh host2 - Successfully logs in with OUT asking for the password


In host2

1) created a new userid - abcd - homedir /opt/abcd
2) created /opt/abcd/.ssh - 700
3) copied /.ssh/authorized_keys to /opt/abcd/.ssh/authorized_keys 644


From host1:

1) Login as root
2) ssh abcd@host2 - prompts for password.

What should be done so that, from host1, I can ssh for any user in host2 without getting the password prompt
# 2  
Old 06-01-2008
On host 2, edit the /home/user/.ssh/authorized.keys and change the key identity:
ssh-rsa LKJojlKlkjMLjpojMPJmlj etc... == root@host1
to :
ssh-rsa LKJojlKlkjMLjpojMPJmlj etc... == user@host1

On host 1 copy the root private key (id_rsa) to /home/user/.ssh/

If this doesn't work, I guess you will need to create a new pair of key for your user the same way you did for root.
# 3  
Old 06-01-2008
Created the keys in host1, while logged in as root & then copied the public key to host2

From host1, initially did

ssh host2 - which worked fine

now,

ssh user2@host2 - prompts for password

In public key it contains root@host1 - which is fine. Coz, am always logged as root in host1 - so no need to change

Not sure how to proceed :-(
# 4  
Old 06-01-2008
Quote:
Originally Posted by vjkatsun
In public key it contains root@host1 - which is fine. Coz, am always logged as root in host1 - so no need to change
On host 2, when you try to login as user@host1 sshd will look for a public key belonging to user@host1, not root@host1 even if you invoque ssh user@host2 in a root session on host1. Hence the need to edit the public key indentification in the host2 authorized_keys. Or to create a new pair of keys for user

To trouble shoot:
$ tail -f /var/log/auth.log | grep ssh # adapt to the log name or UID specific to your *nix box

and report errors when trying to connect.

Last edited by ripat; 06-01-2008 at 02:51 PM.. Reason: Add: trouble shoot
# 5  
Old 06-01-2008
sshd is generally pretty verbal about key exchange issues and can be made more so(-d). Check /var/log/messages or wherever you are logging sshd to or run in the the fg with -D. ssh -v{3} is your friend.

I've seen a similar problem where the key permissions were too open. OpenSSH may not like world readable permissions for your private key.
# 6  
Old 06-02-2008
Quote:
Originally Posted by ramen_noodle
I've seen a similar problem where the key permissions were too open. OpenSSH may not like world readable permissions for your private key.
True. That's indeed a possible cause of connection problems. Check and change the permission as follows:

target /home/user directory 766
target /home/user/.ssh directory 700
target /home/user/.ssh/authorized_keys file 600
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

SSH password less setup asking for password

Hello Experts, when I am trying to connect my target server through sftp after creating ssh password less setup, it is asking for passowrd to connect. to setup this I followed below process: -->generated keys by executing the command "ssh-keygen -t rsa" -->this created my .ssh directory... (9 Replies)
Discussion started by: Devipriya Ch
9 Replies

2. Shell Programming and Scripting

how to run a command line with another user without prompts for password

Hi, I'm writing a script, in the script I need to use tcpdump to capture some packets however it needs root priviledge my computer is configured by school and I have no real root priviledge so I can't use sudo on my computer,like Code: sudo tcpdump ...... I have to use a limited... (1 Reply)
Discussion started by: esolve
1 Replies

3. Shell Programming and Scripting

ssh foo.com sudo command - Prompts for sudo password as visible text. Help?

I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this: #!/bin/bash rsync /path/on/local/machine/ foo.com:path/on/remote/machine/ ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
Discussion started by: fluoborate
9 Replies

4. AIX

Users kicked out after changing their password in an ssh session

Hi I have experienced this for years and just put up with it. However a client of mine now wants to stop this happening to their users. I have scoured the internet but can find no reference to the problem. I tried switching to PAM authentication thinking this might help but it made no... (6 Replies)
Discussion started by: johnf
6 Replies

5. UNIX Desktop Questions & Answers

Too many users with root password

Hi there, I'm working with a Linux server and now I can get a daily Logwatch mail ... my question is:since there are too many users with root password (...in my opinion... :mad:) how could I prevent to delete information about "su" log? Thanks in advance, GB (3 Replies)
Discussion started by: Giordano Bruno
3 Replies

6. Red Hat

SSH Prompts for Password After Keys Setup Successfully

I setup the keys between 2 servers, but my user account has no password specified for it (never set one up on the account for security reasons). When I try to SSH to the server, SSH prompts for a password that doesn't exist (so I can never connect successfully). Note: 'passwd -d Rynok' removes... (3 Replies)
Discussion started by: Rynok
3 Replies

7. Solaris

SSH Password-less login fails on password expiry.

Hi Gurus I have a few Sol 5.9 servers and i have enabled password less authentication between them for my user ID. Often i have found that when my password has expired,the login fails. Resetting my password reenables the keys. Do i need to do something to avoid this scenario or is this... (2 Replies)
Discussion started by: Renjesh
2 Replies

8. UNIX for Dummies Questions & Answers

Have users changed their password

How can I know users have changed their passwords ? I don't need their password (!) I have to know if they have changed their pass word and when ? Thank you in advance for any SIMPLE answer. (6 Replies)
Discussion started by: annemar
6 Replies

9. UNIX for Advanced & Expert Users

password prompts

I would like to log all the commands that are entered on an ssh client. I can do this successfully, however, I dont want to log user logins and passwords. Is there any way to identify passwords and avoid them? For example, I can look for a string 'password:' and ignore everything until a nl/cr. Is... (2 Replies)
Discussion started by: balag
2 Replies

10. Shell Programming and Scripting

scripting password prompts

Hi there Probably a really simple question but I am writing an install script and at certain stages of the install (ie creating a table in mysql) the system prompts for you to enter a password, I was wondering, how do I script this input so that the install doesnt keep stopping for manual... (3 Replies)
Discussion started by: hcclnoodles
3 Replies
Login or Register to Ask a Question