2

I'm trying to have my Raspberry Pi trigger scripts on my Mac which is on the same local network.

SSH is enabled on the Pi. I've created an ssh key so ssh won't ask for a password or passphrase using ssh-keygen.

I can enter the following in terminal on my Pi and it works without a password or a passphrase. Perfect!

ssh [email protected] osascript Applescripts/myscript.scpt

It works in terminal, but it DOESN'T work if I try to use it in the triggerhappy conf file, presumably because triggerhappy is user Nobody, not me. Got it. How do I fix it? I'm not a unix guy, so any specifics are greatly appreciated!

I've tried saving the ssh key to a file in tmp/sshkeyfornobody, setting the permissions to 400 & the user to nobody, and of course reloading triggerhappy.

ssh -i /tmp/sshkeyfornobody [email protected] osascript Applescripts/myscript.scpt

But it still doesn't work, perhaps because user Nobody doesn't have access to the tmp folder? What folders does Nobody have access to for saving the ssh key?

The ONLY function of this Raspberry Pi will be as a controller for my universal remote using a Flirc IR dongle that the Pi sees as a keyboard. I know the Flirc is working properly because I've got a series of curl commands assigned to hotkeys using triggerhappy and they're working perfectly on my Pi (and for anyone not familiar, Flirc is excellent!).

I'm new to unix, Raspbian, etc, so I hope you'll forgive my lack of knowledge here. Feel free to over-explain things, because I'm looking for the answer but I'm equally interested in learning.

4
  • 1
    what errors you see?
    – Jakuje
    Commented Apr 18, 2017 at 7:32
  • I'm in terminal. I see no errors in terminal, but something's not working in triggerhappy. Is there a way for me to see what errors triggerhappy is experiencing?
    – 2oh1
    Commented Apr 18, 2017 at 7:49
  • No idea. But you can always log into file from your happy stuff using bash IO redirection.
    – Jakuje
    Commented Apr 18, 2017 at 7:51
  • Can you explain this, preferably with steps? "you can always log into file from your happy stuff using bash IO redirection" I assume, by "happy stuff" you mean the triggerhappy daemon?
    – 2oh1
    Commented Apr 18, 2017 at 8:39

1 Answer 1

2

I answered my own question. Change the triggerhappy default user to pi or root. On the Pi, it's at:

/etc/default/triggerhappy Simply uncomment the user option to change it from nobody to root, as explained in the file:

# The Triggerhappy daemon (thd) drops its root privileges after
# startup and becomes "nobody". If you want it to retain its root
# status (e.g. to run commands only accessible to the system user),
# uncomment the following line or specifiy the user option yourself:
#
# DAEMON_OPTS="--user root"

Uncomment that last line & relaunch triggerhappy. It's as simple as that. This may not serve everyone's use, but in my case it's perfect because my Pi has only one purpose: It serves as a control, connecting my IoT stuff to a universal remote using a usb Flirc IR receiver. So, I press a button on my universal remote, and Flirc tells my Pi to do keystroke Control+1, which triggerhappy then turns into a command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .