How/Where to Set mythbackend_user

Status
Not open for further replies.

nello

Patron
Joined
Dec 30, 2012
Messages
351
I'm running MythTV with a post-processing ("User Job") script under the mythtv user to transcode and do other things to recordings. Once the processing is done, I want the script delete the original recording; here's an example of a recording file showing its permissions:

-rw-r--r-- 1 root mythtv 2560860424 Apr 29 07:30 1111_20150429120000.mpg

My script is unable to delete the original recording (using rm), apparently because the user mythtv doesn't have write permission.

Can someone tell me how to change the permissions with which recordings are written?

I presume that recordings are written by the user mythtv (though that doesn't explain why root is the owner).

Here's the mythtv home directory:

$ ls -al ~/
total 129
drwxrwxr-x 7 mythtv mythtv 17 Apr 28 20:42 .
drwxr-xr-x 8 root wheel 8 Apr 23 18:21 ..
-rwxrwxr-x 1 mythtv mythtv 102 Apr 23 18:22 .Xauthority
-rwxrwxr-x 1 mythtv mythtv 3200 Apr 23 18:22 .bash_history
-rw-r--r-- 1 mythtv mythtv 116 Apr 28 20:42 .bash_profile
-rwxr-xr-x 1 mythtv mythtv 270 Apr 23 21:00 .bashrc
drwxrwxr-x 2 mythtv mythtv 3 Apr 23 18:22 .config
-rwxrwxr-x 1 mythtv mythtv 965 Apr 23 18:22 .cshrc
drwxrwxr-x 2 mythtv mythtv 3 Apr 23 18:22 .dvdcss
-rwxrwxr-x 1 mythtv mythtv 35804 Apr 23 18:22 .history
-rwxrwxr-x 1 mythtv mythtv 148 Apr 23 18:22 .k5login
-rwxrwxr-x 1 mythtv mythtv 296 Apr 23 18:22 .login
-rwxrwxr-x 1 mythtv mythtv 1160 Apr 23 18:22 .mysql_history
drwxrwxr-x 11 mythtv mythtv 13 Apr 23 18:22 .mythtv
-rwxrwxr-x 1 mythtv mythtv 300 Apr 28 18:10 .profile
drwxrwxr-x 3 mythtv mythtv 6 Apr 23 18:22 .subversion
drwxrwxr-x 2 mythtv mythtv 2 Apr 23 18:22 .xmltv



I've tried entering umask 113 (to produce -rw-rw-r--) in the following files:

~/.profile
~/.bashrc
~/.bash_profile



But permissions on new files don't change; they are always -rw-r--r-- as you can see from this file I created from the mythtv user in nano:

-rw-r--r-- 1 mythtv mythtv 26 Apr 28 20:43 abc.txt

And yes, I logged out of mythtv and logged back in using this command from root:

su mythtv

How can I change the permissions with which recordings are written? If it involves umask, where to I enter it?

Thank you for your time and attention.

- nello

Update 2015.04.29
Yes, I posted this in the MythTV Forum:
https://forum.mythtv.org/viewtopic.php?f=36&t=822
 
Last edited:

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421

nello

Patron
Joined
Dec 30, 2012
Messages
351
Last edited:

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
you don't put it into the login file. You put it in the mythtv config files. I don't use mythtv on freenas so i can't give you specifics but I suspect you just modify the file that the link i posted tells you to modify.
 

nello

Patron
Joined
Dec 30, 2012
Messages
351
… I suspect you just modify the file that the link i posted tells you to modify.

That post says to modify this file:
Code:
/etc/default/mythtv-backend



Unfortunately, this file appears to be specific to Debian and I can't find that file on FreeNAS:

Code:
root@mythtv:/ # find / -name mythtv-backend
root@mythtv:/ # 



Your link also says to put the umask command "… in the environment running mythbackend."

Can you speculate what FreeNAS file controls "… the environment running mythbackend"?


Update 2015-04-29

Okay, I guess the real issue is that the mthybackend is running as root instead of mythtv:
Code:
root@mythtv:~ # ps aux | grep mythtv
root   6211  0.0  0.4 483508 117360 ??  INsJ  7:28PM 22:28.51 /usr/local/bin/mythbackend -d --logpath /var/log/mythtv
root  54434  0.0  0.0  16332   1908  0  RL+J  2:00PM  0:00.00 grep mythtv
root@mythtv:~ # 


These pages all give similar instructions, but I can't find the configuration file they specify on FreeNAS:

Can anyone tell me how FreeNAS sets the user associated with running mythbackend?
 
Last edited:

nello

Patron
Joined
Dec 30, 2012
Messages
351
The file I was looking for is:
Code:
/usr/local/etc/rc.d/mythbackend



In the following line from this script, I changed root to mythtv
Code:
: ${mythbackend_user="root"}



Also, based on the content of the mythbackend script, I made the following ownership/permission changes
Code:
root@mythtv:/var/log # chown mythtv:wheel mythtv
root@mythtv:/var/log # chmod 755 mythtv



After stopping and starting the Jail mythbackend is now running under mythtv:
Code:
root@mythtv:~ # ps aux | grep mythtv
mythtv 71337  0.0  0.2 392244  79272 ??  SsJ  7:41PM 0:00.55 /usr/local/bin/mythbackend -d --logpath /var/log
mythtv 71619  0.0  0.2 365160  71760 ??  IsJ  7:41PM 0:00.66 /usr/local/bin/mythlogserver --daemon --verbose
root   73209  0.0  0.0  16332   1940  0  S+J  7:42PM 0:00.00 grep mythtv
root@mythtv:~ #



Thank you @SweetAndLow for steering me away from looking for a login script and towards a configuration script.

- nello
 
Last edited:

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
ehh i didn't do much, you actually did all the work and figured it out.
 
Status
Not open for further replies.
Top