user permission to launch a program? (cec-client, raspbian and openHAB)
Hello everybody!
Quote:
The command works fine for the default pi user, but the user openhab is unable to execute the command. The cec-commands in question are: echo "standby 0 | cec-client RPI -s -d 1 and echo "on 0 | cec-client RPI -s -d 1 Ive tryed sudo su -u openhab echo "standby 0 | cec-client RPI -s -d 1 witch resulted in a new line in terminal, with only a ">". "sudo su -u openhab ls" does show a list of items in the current folder, so it feels like the openhab user is not allowed to execute the cec-client program. Now, i did find out the list of groups that these users belong to, and i figure that i might solve this issue by adding openhab to one of them, but i havent a clue regarding what specific group could be the important one... pi@openHABserver:~$ groups pi pi : pi adm tty dialout cdrom sudo audio video plugdev games users input netdev bluetooth spi i2c gpio openhab pi@openHABserver:~$ groups openhab openhab : openhab tty dialout audio bluetooth gpio Ive searched the web, but im unable to find out how to check what permissions are needed to execute a program in linux.. And unfortunately, i will not be able to run my commands under another user, openHAB runs under openhab user and all commands executed thru openHAB will be executed as openhab, witch is not a member of sudoers, nor should it for security reasons. So i need a way to fix this but my linux skills are rudimentary at best.. Does anyone have any ideas, hints or suggestions? |
I don't think sudo works with redirection. Try launching a shell with sudo and getting that to do the work, something like sudo sh -c echo "standby 0 | cec-client RPI -s -d 1.
|
im not sure if im really understanding the result correctly, but my command works fine if i type: "sudo su -u pi" before my cec-command.
Im logged in as pi when executing the command above, so im not sure im actually changing the user or if the su-part gets skipped since im aready the pi user.. but i am able to list folder (ls) as openhab with the "sudo su -u openhab ls". so i think that i will need to allow the user openhab to use the cec-client somehow, but i doubt sudo should be involved.. |
You could also use su -c, then put the actual command in quotes. But then you would need to use the root password. Or perhaps you could set the suid bit on cec-client so that it ran as root whoever launched it.
|
Quote:
Quote:
|
Quote:
echo standby 0 | cec-client -s -d 1 Thank you kindly for illuminating the permissions situation! I added the openhab user to pi group and now im allowed to execute the command! :D thanks everyone for the assist! |
Please mark it as solved then.
|
All times are GMT -5. The time now is 11:47 AM. |