[mythtv-users] I broke my mythTV, help!

Stephen Worthington stephen_agent at jsw.gen.nz
Fri Nov 9 06:43:22 UTC 2018


On Thu, 8 Nov 2018 22:02:19 -0800, you wrote:

>I have been attempting to run scripts as the mythtv user. There is a good chance I'm using sudo incorrectly, but below is what I
>attempted and the result.
>
>I hope this is a clue:
>
>$ sudo -H -i -u mythtv checklogin.sh
>sudo: unable to change directory to /home/mythtv: Permission denied
>sudo: unable to execute /bin/sh: Permission denied
>
>
>checklogin.sh is the script I use to see if anyone is logged in before allowing mythtv to shutdown the system.

That is seriously wrong.  The /home/mythtv directory should exist and
be group and user mythtv.  Being unable to change to the /home/mythtv
directory when you are user mythtv says that it has the wrong
ownership.  Or does not exist.  And that would also explain why
mythbackend running as user mythtv is unable to access things under
/home/mythtv.

I would do this to fix the ownership and permissions:

sudo chown mythtv:mythtv /home/mythtv
sudo chmod u=rwx,g=rx,o=rx /home/mythtv

And then you need to check the ownership of files and directories
under /home/mythtv also.  Mostly, they should be ownership
mythtv:mythtv also, unless you have some special files (eg using
sudoers).

But I am not sure why you are getting permissions problems with
/bin/sh.  The /bin/sh executable is normally a link to /bin/dash, and
dash is normally readable and executable by anyone.

If you want to do commands like "sudo -i", I would recommend doing
this command:

sudo chsh -s /bin/bash mythtv

to set the mythtv user's shell to /bin/bash instead of /bin/sh.

After that, what does this command show:

sudo -H -i -u mythtv env


More information about the mythtv-users mailing list