[mythtv-users] Ubuntu 18.04, change mythtv user

Stephen Worthington stephen_agent at jsw.gen.nz
Fri May 18 04:27:15 UTC 2018


On Thu, 17 May 2018 21:13:49 -0500, you wrote:

>Hello,
>
>I would like to change the default user 'mythtv' to something else in
>the init script of the backend. What is the right file to do that?
>
>I changed the 'User=' in /lib/systemd/system/mythtv-backend.service but
>it did not make a difference,
>
>[Service]
>User=mythtv
>EnvironmentFile=-/etc/mythtv/additional.args
>ExecStart=/usr/bin/mythbackend --quiet --syslog local7 $ADDITIONAL_ARGS
>StartLimitBurst=10
>StartLimitInterval=10m
>Restart=on-failure
>RestartSec=1
>
>Thanks

That should have worked, but when you change systemd config files, you
have to run this command to make it see the changes:

systemctl daemon-reload

However, you should never change the files in /lib/systemd/system as
they are installed from the packages and will be overwritten back to
the old version the next time that MythTV package gets updated.  The
correct way to change systemd units is to create an override file
under /etc/systemd/system.  So you should create a directory like
this, from root or using sudo:

mkdir /etc/systemd/system/mythtv-backend.service.d
chmod u=rwx,g=rx,o=rx /etc/systemd/system/mythtv-backend.service.d

In that directory, any files with name *.conf will be read as
overrides for settings in the
/lib/systemd/system/mythtv-backend.service file.  So create a file
called, for example, mythtv-backend-override.conf and put your
override settings inside that.  That file should contain:

[Service]
User=<my new user>

Also note that any user that runs MythTV programs needs to be added to
the mythtv group:

usermod -a -G mythtv <user name>

and probably also a few other groups - check what groups your mythtv
user is a member of:

su - mythtv -c groups


More information about the mythtv-users mailing list