Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 1044  / 1 Year ago, sun, december 11, 2022, 7:52:07

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:



-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?


More From » server

 Answers
4

Try to use the -i argument.
From the man:



-i identity_file
Selects a file from which the identity (private key) for RSA or
DSA authentication is read. The default is ~/.ssh/identity for
protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for pro-
tocol version 2. Identity files may also be specified on a per-
host basis in the configuration file. It is possible to have
multiple -i options (and multiple identities specified in config-
uration files).


Then you can specify the key to use for each host.


[#26402] Tuesday, December 13, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
iedncommon

Total Points: 200
Total Questions: 95
Total Answers: 132

Location: Tonga
Member since Mon, Aug 2, 2021
3 Years ago
iedncommon questions
Sat, Jun 4, 22, 18:20, 2 Years ago
Mon, Apr 4, 22, 08:10, 2 Years ago
Tue, Jul 6, 21, 15:11, 3 Years ago
;