I am searching for a way to run a .sh Script located on MachineB on MachineA. So I don't want to run the script remotely. I want to run the script locally (the script is located on a remote machine).
I have tested this command
ssh pi@192.168.1.2 "/usr/local/bin/nas/script1.sh"
But with this the command get executed remotely.
Background info: MachineA is my Synology-NAS; MachineB is my RaspberryPI.
All my folders on the NAS are encrypted. If the NAS reboots, all folders are unmounted. I want to automate the mounting process, but don't want to share the keys on a USB-Media for security reasons. For that I have a script with the keys for all folders on my PI in an encrypted folder. The PI is online 24/7. For the scenario of theft. The Raspberry will a) not be stolen, b) will power-off and the encrypted folder will be unmounted. So, the keys are safe.
Any help is appreciated.
As a starting point, try:
/bin/bash <<end
`ssh pi@192.168.1.2 "cat /usr/local/bin/nas/script1.sh"`
end