Password less SSH login to different server

Hi,

It is continuation with my other thread, The issue i found is U1 does not set properly for password less ssh.

for setting up password less ssh i followed the following steps

  1. ssh-keygen
  2. ssh-copy-id -i ~/.ssh/id_rsa.pub hostname
  3. /usr/bin/ssh -t -t U1@hostname sample.sh

it is asking password. I tried the same steps for different users and it is working fine.

Please help me to troubleshoot this issue.

for password less ssh from server a to b after generating the keys ,

u need to add the public key of server a

.pub file 

in

authorized_keys

file of server b,also provide appropriate permissions

If you want to connect to remote server from your local without using passwords do the following steps:

  1. Generate the ssh keys on your local using ssh-keygen .
  2. Copy the generated pubic key (by default id_rsa.pub, if you ran ssh-keygen without any options) and place it in the ~U/.ssh/authorized_keys of your remote. I am not sure how to use ssh-copy-id , but you can try using the below code(run it from your local):
locPubKey=$(cat ~/.ssh/id_rsa.pub)
ssh U@remote "echo "$locPubKey" >> ~/.ssh/authorized_keys"
  1. Now try connecting to your local using
ssh U@remote

hi

ssh-copy-id does the same. Copy the content from file
.ssh/id_rsa.pub to authorized_keys file.

In my case, it works for one ID and not working for another ID.