I have one master and four slave computers. I generated rsa public/private key on master PC. Then I copied publickey (id_rsa.pub
) to slave machines as authorized_keys
.
It doesn't ask password when I invoke SSH like this on master PC's terminal:
ssh –o UserKnownHostsFile=/dev/null –o StrictHostKeyChecking=no hduser@slave1
I wrote this script to automatically login slave machines without asking password.
SERVER_LIST=`cat /home/hduser/slaves` # slave1, slave2 ...
USERNAME=hduser
for host in $SERVER_LIST; do
ssh –t –o UserKnownHostsFile=/dev/null –o StrictHostKeyChecking=no -l ${USERNAME} ${host};
done
SSH is asking slaves passwords when I use this script. I'm getting this message when use SSH with -vv
option:
I changed permissions on master PC and slave PC.
sudo chmod 700 -R ~/.ssh
sudo chown hduser ~/.ssh
It still asking password. What am I missing? How can I fix it?
hduser@
. I thought same thing and added it to script but nothing change. – Eyüp Alemdar Mar 21 '14 at 16:08-t
)? – Registered User Mar 21 '14 at 16:11-v
or-vv
flag to ssh in the two cases, and compare the output --- maybe you can spot the problem that way. – Rmano Mar 21 '14 at 16:12-t option
) too but It didn't work. – Eyüp Alemdar Mar 21 '14 at 16:12ssh -v -o ...
from terminal (when it works), save the verbose output. Do the same for thessh
in the script. Save it too. Normally this is sufficient to help you spot the problem, otherwise put the output in the question. – Rmano Mar 21 '14 at 16:15@
to reply to users, otherwise we won't be notified. – Registered User Mar 21 '14 at 16:18id_rsa
andid_rsa.pub
under/home/hduser/.ssh/
directory to/root/.ssh/
directory – Eyüp Alemdar Mar 21 '14 at 18:18