LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SSH without using password (https://www.linuxquestions.org/questions/linux-newbie-8/ssh-without-using-password-4175438070/)

azheruddin 11-21-2012 12:15 AM

SSH without using password
 
HI,

I am trying to do ssh without using password but its not working for me...i will tell what i have done

1.source host---ssh-keygen -t rsa

2.copied id_rsa.pub key and kept on target hosts[in authorized key]

3.but its not working

4.still its not working for me.still its asking
password for me...

both hosts are
Red Hat Enterprise Linux Server release 5.6 (Tikanga)

Regards,
Ajju

evo2 11-21-2012 12:45 AM

Hi,

try using ssh with -v so that you can see the verbose output. Also try looking at what sshd is logging (/var/log/secure on RHEL IIRC).

However, my first guess would be bad permissions on the key files.

Evo2.

azheruddin 11-21-2012 01:15 AM

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: Unspecified GSS failure. Minor code may provide more information
Unknown code krb5 195

debug1: Unspecified GSS failure. Minor code may provide more information
Unknown code krb5 195

debug1: Unspecified GSS failure. Minor code may provide more information
Unknown code krb5 195

debug1: Next authentication method: publickey
debug1: Trying private key: /home/gerbil/.ssh/identity
debug1: Offering public key: /home/gerbil/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Offering public key: /home/gerbil/.ssh/id_dsa
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: password
password:

so above is the verbose o/p and file permissions looks good i.e -rwxr-xr-x for aut..Key..

fakie_flip 11-21-2012 02:09 AM

Quote:

Originally Posted by azheruddin (Post 4833782)
HI,

I am trying to do ssh without using password but its not working for me...i will tell what i have done

1.source host---ssh-keygen -t rsa

2.copied id_rsa.pub key and kept on target hosts[in authorized key]

3.but its not working

Use this command example:
Code:

ssh-copy-id -i ~/.ssh/id_rsa.pub user@host:
Do not forget the :
Maybe the : is not needed, but it is when you use scp.

It's much easier than copying the file over manually. It will append to authorized host instead of overwriting it, and it's created for this. It also does error checking.

Quote:

4.still its not working for me.still its asking
password for me...
Is it asking for the user's password or the password to the ssh key you created?

To stop it from asking the password to the ssh keys you created, be sure ssh-agent is running.

You can start it manually by typing ssh-agent, but you would have to do this after each reboot, or you can have it start automatically by your login scripts.

To start it automatically:

Add this to your ~/.bash_profile

Code:

if [ "$(pidof ssh-agent)" ]
then
  break # ssh-agent is already running
else
  ssh-agent # ssh-agent is not running, start it
if

Now each time you login even if multiple times, ssh-agent should only be running once.

ssh-agent still needs your login credentials, the private key.

After you have logged in and ssh-agent is running, use the command:

Code:

ssh-add
To add your key identity to ssh-agent.

Now when you ssh to a server that contains your public key, you will not be prompted for your ssh private key password each time.

jsaravana87 11-21-2012 02:34 AM

Main reason for ssh passwordless failure could be permission .Cross check whether you had enable wright permission for keys & .ssh file
Check the sshd_ config file you had whether enable authorized_ keys file path file & pubkey attentication yes in your sshd_ config file

Look after the link for passwordless login

http://www.linuxquestions.org/questi...os-rhel-35029/

azheruddin 11-21-2012 03:15 AM

it is asking user's password not ssh Key password, which I dont want

actually i am automating some task through script this password asking makes a problem .

jsaravana87 11-21-2012 03:21 AM

what you had tried in your part ? Did you Cross check your permission of keys &.ssh file ? Did you enable pub key attentication to yes in sshd_config file ? Did you look after the link what i have posted above ?

fakie_flip 11-21-2012 03:45 AM

Quote:

Originally Posted by azheruddin (Post 4833861)
it is asking user's password not ssh Key password, which I dont want

actually i am automating some task through script this password asking makes a problem .

Remove the authorized_keys file. Start over using the instructions I gave you. It will work. If it doesn't, please post back, and I will help you.


All times are GMT -5. The time now is 10:59 AM.