[mythtv-users] Ownership problem on recordings.

Eloy Paris peloy at chapus.net
Mon Jun 29 04:15:35 UTC 2009


Hi John,

On Mon, Jun 29, 2009 at 11:27:00AM +1000, john blue wrote:

> On Sun June 28 2009 22:33:32 Eloy Paris wrote:

[...]

> > What is the output from "ps aux"? Look specifically at the mythbackend
> > process.
>
> Hi Eloy,
> 
> Thanks for the reply.
> 
> psaux shows this as the only reference to mythbackend.
> root      7195  0.3  5.7 599612 117576 ?       Ssl  Jun28   4:05 /usr/bin/mythbackend --daemon --logfile /v
> 
> From that I gather that root has ownersip of the process and that may
> be why I have the problem with ownership.

Yes, I believe that's the root cause of your problem. On my system, the
mythbackend process looks like this:

$ ps ax | grep myth
mythtv    4887  2.0  1.6 226400 17384 ?        Ssl  Jun28  11:04 /usr/bin/mythbackend --daemon --logfile /var/log/mythtv/mythbackend.log --pidfile /var/run/mythtv/mythbackend.pid --verbose important,general --noupnp

> However, as mentioned I am using SuSE 11.1 and standard mythtv        
> packages for SuSE from the packman repositories. If I look at the     
> /usr/bin directory for mythtv files there are several mythtv files    
> all owned by root with group root.                                    
> 
> mythtv at mythtv:/usr/bin> ls -l myth*
> -rwxr-xr-x 1 root root  311552 2009-02-23 03:03 mytharchivehelper
> -rwxr-xr-x 1 root root 1142408 2009-05-20 08:11 mythbackend
> -rwxr-xr-x 1 root root  107680 2009-02-23 03:03 mythbrowser
> -rwxr-xr-x 1 root root  533016 2009-05-20 08:11 mythcommflag
> -rwxr-xr-x 1 root root  303760 2009-05-20 08:11 mythfilldatabase
> -rwxr-xr-x 1 root root 1484872 2009-05-20 08:11 mythfrontend
> -rwxr-xr-x 1 root root   31656 2009-05-20 08:11 mythjobqueue
> -rwxr-xr-x 1 root root  233288 2009-05-20 08:11 mythlcdserver
> -rwxr-xr-x 1 root root   85520 2009-05-20 08:11 mythreplex
> -rwxr-xr-x 1 root root   89264 2009-05-20 08:11 mythshutdown
> -rwxr-xr-x 1 root root  333112 2009-05-20 08:11 mythtranscode
> -rwxr-xr-x 1 root root   44200 2009-05-20 08:11 mythtv
> -rwxr-xr-x 1 root root   23352 2009-05-20 08:11 mythtvosd
> lrwxrwxrwx 1 root root      12 2009-06-25 15:22 mythtvsetup -> mythtv-setup
> -rwxr-xr-x 1 root root  164048 2009-05-20 08:11 mythtv-setup
> -rwxr-xr-x 1 root root  148656 2009-05-20 08:11 mythwelcome
> 
> Would I need to change the permissions here to resolbe the problem?   
> and if I did wouldn't the permissions be overwritten with any         
> software upgrade?                                                     

No, you should not change the permissions of the myth* binaries. My
myth* binaries have the same permissions as yours. What you need to
do is find out what starts the mythbackend process and modify it so
mythbackend runs as the "mythtv" user (provided that you have a "mythtv"
user in /etc/passwd and that this user has write access to wherever your
recordings are being stored, which I believe is the case already if I
remember correctly.)

In Debian, using Christian Marillat's MythTV packages, what starts the
backend is /etc/init.d/mythtv-backend. I don't know anything about SuSE
but you see if you have a /etc/init.d directory with some script that
starts the backend. Then look into it to see if you have an option to
change the user the backend will start as.

I'm attaching the init.d script that my MythTV package uses to start the
backend. The key is the --chuid parameter to start-stop-daemon -- this
tells the system to switch to the "mythtv" user (from the "root" user)
when the backend is started. You're SuSE system hopefully has something
similar.

Cheers,

Eloy Paris.-
-------------- next part --------------
#! /bin/sh
### BEGIN INIT INFO
# Provides:          mythtv-backend
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      S
# Short-Description: Start/Stop the MythTV server.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/mythbackend
NAME="mythbackend"
DESC="MythTV server"

test -x $DAEMON || exit 0

set -e

USER=mythtv
RUNDIR=/var/run/mythtv
ARGS="--daemon --logfile /var/log/mythtv/mythbackend.log --pidfile $RUNDIR/$NAME.pid"
EXTRA_ARGS=""
NICE=0

if [ -f /etc/default/mythtv-backend ]; then
  . /etc/default/mythtv-backend
fi

ARGS="$ARGS $EXTRA_ARGS"

mkdir -p $RUNDIR
chown -R $USER $RUNDIR

unset DISPLAY
unset SESSION_MANAGER

case "$1" in
  start)
	if test -e $RUNDIR/$NAME.pid ; then
		echo "mythbackend already running, use restart instead."
	else
		echo -n "Starting $DESC: $NAME "
		start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
			--chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
		echo "."
	fi
	;;
  stop)
	echo -n "Stopping $DESC: $NAME "
	start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
		--chuid $USER --exec $DAEMON -- $ARGS
	test -e $RUNDIR/$NAME.pid && rm $RUNDIR/$NAME.pid
	echo "."
	;;
  restart|force-reload)
	echo -n "Restarting $DESC: $NAME "
	start-stop-daemon --stop --oknodo --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --exec $DAEMON -- $ARGS
	echo "."
	sleep 3
	start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
                --chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
	echo "."
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0


More information about the mythtv-users mailing list