I'm a system administrator in a company based in Tunisia. I control 50+ Raspberry Pis with Debian Jessie. I connect frequently over SSH with the same password for all of them.
Is there any solution to use the password once and not enter it again?
My PC: gnome-Ubuntu 16.04
Raspberry Pis: Jessie arm6vl
Ubuntu has a package called sshpass. Install it on Ubuntu 16.04 like this:
sudo apt install sshpass
And use it like this:
sshpass -p 'YourPassword' ssh user@host
For multiple hosts you can do something like:
for host in hostname1 hostname2 hostname3; do \
sshpass -oStrictHostKeyChecking=no \
-p 'YourPassword' ssh user@${host} "hostname; df -h; echo"; done
The StrictHostKeyChecking disables the usual SSH check that the remote machine is in your list of known hosts; if you are deploying a Pi farm this will probably be the case. When using sshpass, instead of displaying the message 'The authenticity of host xxxx can't be established', the command silently fails without this option.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments