Shut down multiple Raspberry Pies remotely

Tuesday, August 23, 2016

I have multiple Raspberry Pies and one main proxy Pi which monitor these pies.
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:
whoami
Lets generate some public key content:
ssh-keygen
After 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:
whoami
Now I create this new script:
vi ~/emergency-shutdown.sh
Lets 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'
done
Set the script executable:
chmod +x ~/emergency-shutdown.sh
To shut down everything I use:
./emergency-shutdown.sh

Meow and green birdy

Sunday, August 21, 2016

Add Public Folder Owner permission, PowerShell, Exchange

Wednesday, August 10, 2016

List all folders:
Get-PublicFolder -Identity "\" -Recurse
Add permissions to single public folder:
Add-PublicFolderClientPermission -Identity "\Custom Folder Name" -Recurse -AccessRights Owner -User usernamegoeshere
Add permissions to all public folders:
Get-PublicFolder –Identity "\" –Recurse | Add-PublicFolderClientPermission –User usernamegoeshere –AccessRights Owner
Related:
http://port25guy.com/2009/11/13/how-to-apply-permissions-to-public-folder-and-all-sub-folders-in-exchange-20072010-using-exchange-management-shell/
Archive