|
SageTV Linux Discussion related to the SageTV Media Center for Linux. Questions, issues, problems, suggestions, etc. relating to the SageTV Linux should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Running as root or not
Hi,
I'm perfecting my WFE plugin for linux and noted from another thread that some people run sagetv as root (I guess this is what you get by default) and some people (following best practice) run sagetv as another user. I've got my plugin working where everything runs as root. I know want to test where sagetv runs as a different user. Is there a step by step guide for doing this anywhere? Michael |
#2
|
|||
|
|||
Here's what I did
Code:
sudo useradd --system -d /opt/sagetv/server/ -s /bin/false -g video -c "sagetv" sagetv sudo chown -R sagetv.video /opt/sagetv/server The second line allows the sagetv user to write to the folders that sagetv is using. hope this helps |
#3
|
|||
|
|||
Quote:
There's also the matter of starting sagetv at system boot. I don't know what the .deb installs. I took the mythtv startup script and modified it to start sage back in the 8.04 days, and am still using it: Code:
% cat /etc/init.d/sagetv #!/bin/sh ### BEGIN INIT INFO # Provides: sagetv # Required-Start: $network $local_fs # Required-Stop: $network $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop the SageTV server. ### END INIT INFO PATH=/opt/jre/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/comskip DAEMON=/home/sagetv/server/startsage NAME="sagetv" DESC="SageTV server" test -x $DAEMON || exit 0 set -e USER=sagetv RUNDIR=/var/run/sagetv #ARGS="--daemon --logfile /var/log/mythtv/mythbackend.log --pidfile $RUNDIR/$NAME.pid" EXTRA_ARGS="" NICE=0 ARGS="$ARGS $EXTRA_ARGS" mkdir -p $RUNDIR chown -R $USER $RUNDIR case "$1" in start) echo -n "Starting $DESC: $NAME" # start-stop-daemon --start \ # --chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS su - $USER -c /home/sagetv/server/startsage echo "." ;; stop) echo -n "Stopping $DESC: $NAME " /home/sagetv/server/stopsage echo "." ;; restart|force-reload) echo -n "Restarting $DESC: $NAME" /home/sagetv/server/stopsage echo "." sleep 3 # start-stop-daemon --start \ # --chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS su - $USER -c /home/sagetv/server/startsage echo "." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0 % ls -l /etc/rc*.d/* | grep sagetv lrwxrwxrwx 1 root root 16 Sep 5 15:14 /etc/rc0.d/K99sagetv -> ../init.d/sagetv* lrwxrwxrwx 1 root root 16 Sep 5 15:14 /etc/rc1.d/K99sagetv -> ../init.d/sagetv* lrwxrwxrwx 1 root root 16 Sep 5 15:12 /etc/rc2.d/S99sagetv -> ../init.d/sagetv*
__________________
Server HW: AMD Ryzen Threadripper 2990WX 32-Core Server SW: FreeBSD-current, ZFS, linux-oracle-jdk1.8.0, sagetv-server_9.2.2_amd64 Tuner HW: HDHR Client: Nvidia Shield (HD300, HD100 in storage) |
#4
|
|||
|
|||
Quote:
This is mine Code:
#! /bin/sh SAGEJAVADIR=/opt/jre/bin/java SAGEPATH=/opt/sagetv/server SAGEUSER=sagetv case "$1" in start) echo -n "Starting SageTV server " touch /var/run/sagetv.pid && chown $SAGEUSER /var/run/sagetv.pid sudo -u $SAGEUSER PATH=$SAGEJAVADIR:$PATH $SAGEPATH/startsage 2> /dev/null ;; stop) echo -n "Shutting down SageTV " $SAGEPATH/stopsage ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac |
#5
|
|||
|
|||
Here is the .deb package startup script:
Code:
#! /bin/sh ### BEGIN INIT INFO # Provides: sagetv # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: SageTV Server # Description: This is the init script for the SageTV service # that handles clients and recordings. ### END INIT INFO # # Author: Jean-Francois Thibert <jeanfrancois@sagetv.com>. # # Version: @(#)sagetv 6.5 Jan-2009 # set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="SageTV Server" NAME=sagetv SCRIPTNAME=/etc/init.d/$NAME # Gracefully exit if the package has been removed. test -x /opt/sagetv/server/startsage || exit 0 # # Function that starts the daemon/service. # d_start() { nohup /opt/sagetv/server/startsage } # # Function that stops the daemon/service. # d_stop() { /opt/sagetv/server/stopsage } case "$1" in start) echo -n "Starting $DESC: $NAME" d_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" d_stop || true echo "." ;; restart|force-reload) echo -n "Restarting $DESC: $NAME" d_stop || true sleep 3 d_start echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac exit 0
__________________
SageTV Server v9.2.2, Ubuntu Server 18.04.4 x64, Java 1.8.0_252, Xeon E5-2690, 32GB, 6X6TB WD Red - Software Raid 6, 2X HDHR3 (OTA), 3X HD-200 |
#6
|
|||
|
|||
Thanks guys
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Show root import folders | Oats | SageMC Custom Interface | 3 | 09-06-2009 10:29 PM |
ERROR:Root element is missing. | enterpryse | SageTV EPG Service | 3 | 01-22-2009 12:47 PM |
Server only run as root | Kevintimm | SageTV Beta Test Software | 8 | 05-23-2008 05:51 PM |
Richard Dawkins - Root of All Evil | Steve2112 | The SageTV Community | 2 | 12-09-2007 07:46 PM |
Files in root of C? | obrian93 | SageTV Software | 2 | 03-30-2006 09:17 PM |