What user does tvheadend run as?
Detailed description of problem. (Other requested info below)
I'm a total noob to Linux (but an experienced Windows admin).
I'm trying to configure Tvheadend to record to my NAS. I need to configure a user on the NAS to have write access on the share/folder, and I need to mount the folder on the file system. The issue is that I don't know which user is running Tvheadend. I've run
service --status-all and can see it's running as a service.
Then, I've done:
[email protected]:~ $ ps -aux | grep tvheadend hts 492 1.7 3.4 259020 32876 ? Ssl 10:16 1:25 /usr/bin/tvheadend -f -u hts -g video
which I think means it's running as user
hts, and then I've done:
[email protected]:~ $ cat /etc/passwd | grep hts hts:x:115:124::/home/hts:/bin/bash
htsuser created by the installation in order to run Tvheadend as a service?
hts user the one used to write recordings to the Recording system path? If so, I need to create
hts on my NAS in order to be able to save recordings there?
I noticed that the file/directory permissions are 'in Linux'. Will Tvheadend write to an SMB share if it's mounted?
Final general question: I thought I had read that GIDs below 1000 were reserved for system use and had interpreted that to mean by the builders of Linux. Am I to reinterpret that as meaning anything that doesn't require an interactive logon?
Version of TVHeadend?
HTS Tvheadend 4.2.8-34~g24a2f59e9
Running on what OS and version?
Raspbian GNU/Linux 10 (buster)
Package that came with the OS or something you compiled yourself?
Adapter/tuner chipset or make/model?
Raspberry Pi TV HAT (Sony CXD2880 TV tuner)
Installed Tvheadend by following:
RE: What user does tvheadend run as? - Added by Ron L about 2 years ago
Default installation from deb package user hts is created and TVHeadend runs under these. TVHeadend can be run as any user or group you like, just don't use root. If it is being started as a service look to configuration file /etc/default/tvheadend. Edit
and change to user and group you prefer. Restart tvheadend service. I just run TVH under my own user account and group video. .hts is in my home dir. Not a public system so handier for me.
Should write to any share once it's mounted as long as permissions are given. Can also use NFS share if available on your NAS.
RE: What user does tvheadend run as? - Added by Dave H about 2 years ago
"which I think means it's running as user hts"
"Is the hts user created by the installation in order to run Tvheadend as a service?"
"I noticed that the file/directory permissions are 'in Linux'. Will Tvheadend write to an SMB share if it's mounted?"
I'm not familiar with SMB. A quick search says the answer is yes providing it is not mounted read-only on the SMB side and the linux permissions are set properly on the mounted directory.
You can check what permissions are seen on the linux system with 'ls -l'. If you need to change ownership then you'll need to use the chown command and you'll need to be root (i.e. sudo) to do it.
"Final general question: I thought I had read that GIDs below 1000 were reserved for system use and had interpreted that to mean by the builders of Linux. Am I to reinterpret that as meaning anything that doesn't require an interactive logon?"
No, it means a 'system' user as opposed to a 'living breathing' user. Google will give you a better and more complete answer.
RE: What user does tvheadend run as? - Added by Fred Fred about 2 years ago
A few years ago I made a guide for myself (and others) about how I used to run Tvheadend on Debian in a VM running on hyper-v, I like you mostly use Windows.
The guide is here: https://tvheadend.org/boards/4/topics/28598?r=35470#message-35470
And in that guide there is a section on using automount to a share on a windows pc from the linux machine.
I'm not sure any of that is of much use to you but read it and things might work, best of luck
Here's the snip from that guide:
As I wrote above I use a Windows machine to store all larger recordings, its a Win10 called mypc and have ip 192.168.1.2 with a share called recordedtv, ther is a local user on it called kodi with the passwork kodi and this user have full permissions on the share and folder on the machine.
I dont want this to be permanently attachaed - so the solution is autofs.
To add recordings to my Windows machine here is how:
sudo apt-get install cifs-utils autofs
sudo mkdir /mnt/mypc
sudo chmod 7777 /mnt/mypc
Add this at the bottom of the file and comment the line +auto.master and paste the info
sudo nano /etc/auto.master
/mnt/mypc /etc/auto.mypc --timeout=60 --ghost
To save: ctrl+o (enter)
To exit: ctrl+x
sudo id hts
Replace uid and gid with what the user hts have on you system and then paste the line
sudo nano /etc/auto.mypc
recordedtv -fstype=cifs,rw,username=kodi,password=kodi,uid=107,gid=111 ://192.168.1.2/recordedtv
To save: ctrl+o (enter)
To exit: ctrl+x
sudo /etc/init.d/autofs restart
In TVH webgui enter this as recordingpath to store recordings on you Win PC: