I using
for i in <ip1> <ip2> ... <ipn>; do ssh pi@$ip sudo halt; done
to turn off multiple raspberry pi. But i don't want iput password one by one for a lot of raspberry pi. So what should I do that?
1 Answer
This question is not Raspberry-specific.
Read up ssh key-based authentication as put e.g. here
As soon you have the shared key created and copied it onto the target hosts (simplest method: use ssh-copy-id), you can start an ssh agent on the coordinating host (e.g. in its .profile or .xinitrc) and only need to type the key password once per session with ssh-add.
Or use passwordless keys.
-
... and if I may add: check out Steve Robillard's series on the topic on our blog: SSH Security and Usability – Part 1 (and follow-ups).– Ghanima ♦Commented Oct 17, 2018 at 5:00