[mythtv-users] Raspberry Pi 4 FrontEnd Remote Control Issues

Stephen Worthington stephen_agent at jsw.gen.nz
Mon May 18 03:26:49 UTC 2020


On Sun, 17 May 2020 16:00:51 -0500, you wrote:

>
>Hi Stephen!
>
>
>A couple/few/several questions, please.
>
>
>> You have to edit the /etc/lirc/irexec.lircrc file first. In you case, 
>> comment out or delete everything in the file, then select one key from 
>> the remote to start mythfrontend
>
>I didn’t have one to begin with so figured just create it as you said to 
>delete everything inside. after troubleshooting not sure the lack of a 
>file isn’t pointing to another problem. What I do have in the file is:
>
>begin
>
>      remote = devinput
>
>      prog = mythtv
>
>      button = KEY_C
>
>      config = “su -l pi -c /home/pi/Load_MythFE.sh &”
>
>      repeat = 0
>
>      delay = 0
>
>end
>
>
>
>Without the -c switch it was complaining “cannot execute binary file”. 
>Found that little trick on the web. (Found what it was ‘complaining’ 
>about when testing at Terminal.)
>
>
>A sub-problem is the need to enter a password. The insertion of the -c 
>switch didn’t change the need. So now need to find out how to do that. 
>The good news is we (OK, you!) can be ‘sloppy’ and have a plain text 
>display as all the FEs have a common password.
>
>
>> It is possible that it will need a DISPLAY=:0 environment setting as
>> well, in which case you would probably need to run a script from the
>> su -l command and put the environment setting in there.
>
>And having problems figuring that one out. The Load_MythFE.sh is:
>
>
>#!/bin/bash
>
>DISPLAY=:0 <==zero
>
>su -l pi -c /usr/bin/mythfrontend
>
>
>Just dawned on me: do I need the ‘su -l pi -c’ string as it’s in irexec 
>file

 Nope! Now to figure out passing the the password.
>
>
>Well, made your life a hare simpler! Will continue to try to figure out 
>the password thing.
>
>
>As always, TIA!
>
>Barry

Getting rid of the need for a password is tricky.  It involves
creating an /etc/sudoers.d file that allows a particular executable to
be run without a password.  I have done this for helper scripts, to
allow them to be run as root from non-root users.  It should also work
to allow one user to run things as another user.  But the sudoers file
options are not exactly straightforward.  This is what I have for my
mythtv-systemctl-helper.sh script, which allows mythtv user or mythtv
group users to run mythtv-systemctl-helper.sh without a password:

root at mypvr:/etc/sudoers.d# cat mythtv-systemctl-helper
mythtv,%mythtv
ALL=NOPASSWD:/home/mythtv/bin/mythtv-systemctl-helper.sh

(all on one line)

The first "mythtv" is the mythtv user.  The "%mythtv" is mythtv group.
The mythtv-systemctl-helper.sh file is owner root and group mythtv,
and gets run as its owner (root), which allows it to do systemctl
commands.  But as it does not have "group" or "other" write
permission, the mythtv user and group can not edit the file to get it
to do arbitrary commands as root, so it is not a security risk - it
will only do the systemctl commands the script is set up to allow.

So what I think you need for your Load_MythFE.sh file is to have that
file be owner <your mythfrontend user> and group mythtv, and chmod
u=rwx,g=rx,o=r.  Then try this in a new /etc/sudoers.d file
"Load_MythFE"

<your mythfronend user> ALL:NOPASSWD:<full path to
Load_MythFE.sh>/Load_MythFE.sh

(all on one line).

Files in /etc/sudoers.d need to be chown root:root and chmod
u=r,g=r,o= or they will be ignored.

I think you will need to move the "su -l" command into the
Load_MythFE.sh file.


More information about the mythtv-users mailing list