Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: non-root rights



quoting Stefan Huelswitt (s.huelswitt@gmx.de)
sent: Thu, Apr 17, 2003 at 08:15:44AM +0000

> On 17 Apr 2003 mailinglists@peess.de wrote:
>
> > root@streamer:~# su - media
> > media@streamer:~$ ls -las /dev/dvb/
> > total 0
> >    0 drwxr-xr-x    1 root     root            0 Jan  1  1970 .
> >    0 drwxr-xr-x    1 root     root            0 Jan  1  1970 ..
> >    0 drw-rw----    1 media    media           0 Jan  1  1970 adapter0
> > media@streamer:~$ ls -las /dev/dvb/adapter0/
> > ls: /dev/dvb/adapter0/..: Permission denied
> [...]
>
> Directories must have x-permission if someone wants to enter or
> list them.
>
> For the directories rwxr-xr-x should be enough, while the device
> nodes should be rw-rw-r--. It's enough for them to be root.media
> too (if the vdr user is member of group media).
>
> --
> Stefan Huelswitt
> huels@iname.com  | http://home.pages.de/~nathan
>
>
> --
> Info:
> To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr"
as sub
ject.
>

right, that was it.

the only deficiency is that i can't send it into background ( --daemon ),
see threat <start by system-v script>, so the script never reaches the
end:

root       406   259  0 17:59 ?        00:00:00 /bin/sh
/etc/rc2.d/S99vdr-1.1.x

maybe usage of debian's start-stop-daemon is completely obsolete now...
to summarize, here's the ( working ) system-v script:

root@streamer:~# cat /etc/init.d/vdr-1.1.x
#!/bin/sh
#
# startup script for the 'video disc recorder' and its drivers
#
# description: video disc recorder dumps your dvb streams on disc
#

DAEMON="/opt/vdr-1.1.27/bin/vdr"
ARGS="--config=/opt/vdr-1.1.27/etc/ --epgfile=/mnt/tmpfs/epg.data
--shutdown=/opt/scripts/system_shutdown --terminal=/dev/tty1
--video=/home/media/dvb/"

## modules of driver version 1.0.0-pre
MODULES="dvb-ttpci evdev ves1820 stv0299 grundig_29504-491
grundig_29504-401
alps_tdlb7 alps_tdmb7 alps_bsrv2 dvb-core videodev"


test -f $DAEMON || exit 0

case "$1" in
  start)
        echo "loading 'digital video broadcast driver'"
        make -C /opt/dvb-2003_04_13/driver insmod 2>&1 > /dev/null
        chown -R root:media /dev/dvb/
        chmod 750 /dev/dvb/adapter?/
        chmod 660 /dev/dvb/adapter?/*
        echo "."
        echo -n "starting 'video disc recorder' daemon: vdr"
        start-stop-daemon --start --quiet --pidfile /var/run/vdr.pid \
                --chuid=media:media \
                --exec $DAEMON -- $ARGS
        echo "."
        ## give vdr time to fork, so that its pids are in a nicer
sequence
        sleep 1
        ;;
  stop)
        echo "stopping 'video disc recorder' daemon: vdr"
        start-stop-daemon --stop --quiet --pidfile /var/run/vdr.pid \
                --exec $DAEMON
        ## as there's no pidfile created yet clean up behind
        killall -TERM vdr
        ## give vdr time to finish
        sleep 2
        ## if vdr has crashed kill him
        killall -KILL vdr
        echo "."
        echo "deloading 'digital video broadcast driver'"
        modprobe -r $MODULES
        rm -rf /dev/ost
        rm -rf /dev/ost
        echo "."
        ;;
  restart|force-reload)
        echo "stopping 'video disc recorder' daemon: vdr"
        start-stop-daemon --stop --quiet --pidfile /var/run/vdr.pid \
                --exec $DAEMON
        ## as there's no pidfile created yet clean up behind
        killall -TERM vdr
        ## give vdr time to finish
        sleep 2
        ## if vdr has crashed kill him
        killall -KILL vdr
        echo "."
        echo "deloading 'digital video broadcast driver'"
        modprobe -r $MODULES
        rm -rf /dev/ost
        rm -rf /dev/ost
        echo "."

        echo "loading 'digital video broadcast driver'"
        make -C /opt/dvb-2003_04_13/driver insmod 2>&1 > /dev/null
        chown -R root:media /dev/dvb/
        chmod 750 /dev/dvb/adapter?/
        chmod 660 /dev/dvb/adapter?/*
        echo "."
        echo -n "starting 'video disc recorder' daemon: vdr"
        start-stop-daemon --start --quiet --pidfile /var/run/vdr.pid \
                --chuid=media:media \
                --exec $DAEMON -- $ARGS
        echo "."
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index