I want to shut down all other pies without entering any password.
To do this task I have to set the main RPi very trusted and let other pies know that this one is the king. Lets log into the main pi now.
Make sure I am logged with user [pi] right now:
whoamiLets generate some public key content:
ssh-keygenAfter this command I need to press [Enter] two times.
With user [pi] I need to install this key on all other pies:
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.99.61 ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.99.62 ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.99.63 ..Again make sure you are user [pi] right now:
whoamiNow I create this new script:
vi ~/emergency-shutdown.shLets create some loop with host names in array:
#!/bin/sh for a in 192.168.99.61 192.168.99.62 192.168.99.63 192.168.99.64;do ssh -t pi@$a 'sudo shutdown -h now' doneSet the script executable:
chmod +x ~/emergency-shutdown.shTo shut down everything I use: