run tvheadend as root ?
Added by Greg Kotner over 8 years ago
Hi there
I tried to run tvheadend on a Raspberry Pi 2, the installation out of the provided package did not recognize my USB device and with the self-compiled version, the configuration was erased everytime after reboot.
My quick and dirty solution was to remove the /etc/init.d/tvheadend and start tvheadend manually as root via crontab.
Now it works very well but I don`t know if this is secure.
Is it OK to run tvheadend as root ?
Replies (2)
RE: run tvheadend as root ? - Added by Jonathan Thomson over 8 years ago
It's not good practice to run anything as root but I guess it depends if there's anything else on the RPi and whether it's connected to the internet (externally accessible) or not.
The failure to recognise a device sounds like the user you were running TVH as was not a member of the relevant groups - I know for sure that the user needs to be in the "video" group on Debian/Ubuntu installs and I'm guessing you are using something like Raspbian as your RPi OS?
Just double check a couple of things:
That the relevant user and settings are configured in /etc/default/tvheadend
That the user (as configured above) has access to the relevant groups on your OS
My TVH is self-compiled on Debian and it works great, admittedly not a Raspberry Pi but the underlying setup is the same.
RE: run tvheadend as root ? - Added by Hiro Protagonist over 8 years ago
Greg Kotner wrote:
Is it OK to run tvheadend as root ?
You shouldn't need to. If you're not able to access devices, it will simply be a matter of fixing up permissions.
From /etc/default/tvheadend
# TVH_USER # if set to "" will run as root TVH_USER="pi" # TVH_GROUP # if set to "" will run as root TVH_GROUP="video"
The above defines the user & group the tvheadend process runs with.
l /dev/dvb/
drwxr-xr-x 2 root root 120 Apr 2 14:17 adapter0/
drwxr-xr-x 2 root root 120 Apr 2 14:17 adapter1/
drwxr-xr-x 2 root root 120 Apr 2 14:17 adapter2/
l /dev/dvb/adapter0
total 0
drwxr-xr-x 2 root root 120 Apr 2 14:17 ./
drwxr-xr-x 5 root root 100 Apr 2 14:17 ../
crw-rw---- 1 root video 212, 4 Apr 2 14:17 demux0
crw-rw---- 1 root video 212, 5 Apr 2 14:17 dvr0
crw-rw---- 1 root video 212, 3 Apr 2 14:17 frontend0
crw-rw---- 1 root video 212, 7 Apr 2 14:17 net0
The DVB adapter internals have rw access for owner [root] and group [video], as tvheadend is running as group video it has rw access.
The simplest approach is to verify what group your USB device is installed with & ensure tvheadend is set to that group.