This question is related to the two other questions I had earlier, about enabling Raspberry Pi to act as a motion sensor that will try to ssh into a more powerful server when it detects motion (the more power server will then do additional processing via a script). So here's what I did:
- On the Raspberry Pi, I installed Linux motion app
- I also used
ssh-keygenon the Raspberry Pi and then using
ssh-copy-idcopies public keys to the more power server, so that the Raspberry Pi can
sshto the server without having to type in the password.
motion.conffile, there's a line for
on_motion_detectedevent for when the motion is detected by Raspberry Pi, on that line, I have something like:
ssh email@example.com '/exec/some/script/here'
But the script on the more powerful server is never executed because the motion daemon is running as user 'motion', rather than the user (pi) that did the ssh-keygen that the remote server accepts. I know this because:
If I change the
on_motion_detected echo hello_world | wall
this command gets executed and I see it on all the terminals that are ssh'd into the Raspberry Pi
- Or, if instead of on the on_motion_detected line, I simply run
ssh firstname.lastname@example.org '/exec/some/script/here'on the Raspberry Pi's command line (as user 'pi'), it also gets triggered by the server.
So the question is, how do tell the Raspberry Pi's operating system to 'use' the key of the 'pi' user when the 'motion' user tries to ssh into the more powerful server, in that