Page 1 of 1

running subsonic as a non privileged user

PostPosted: Fri Nov 11, 2011 10:39 am
by Carrot Cruncher
hi. are there any plans for the next release of subsonic to run as a non privileged user (i.e. not root) ? i can see from the 4.5 change log that the debian/ubuntu package was changed to run as a non root user and then changed back again but, having searched the forums, i can't see why. i can also see in the forums that there are instructions for amending the installation on ubuntu to run as a non root user however i'm running it on fedora and nothing i've tried works successfully. i'm also aware that subsonic can run under something like tomcat however this is a bit ott for me, just to run one application that can run standalone. cheers.

Re: running subsonic as a non privileged user

PostPosted: Fri Nov 11, 2011 4:11 pm
by BKKKPewsey
Carrot Cruncher wrote:i can see from the 4.5 change log that the debian/ubuntu package was changed to run as a non root user and then changed back again but, having searched the forums, i can't see why.

This may explain why http://forum.subsonic.org/forum/viewtopic.php?f=4&t=7438
Running on Windoze meself so no comment :mrgreen:

Re: running subsonic as a non privileged user

PostPosted: Sat Nov 12, 2011 1:49 pm
by Carrot Cruncher
thanks for the response. do you know if this means it isn't going to be investigated any further ?

for info, i've just managed to amend my installation to run as a non root user by running the following :
systemctl stop subsonic.service
adduser --system -M --groups audio subsonic
chown -Rh subsonic:subsonic /var/subsonic
chown -Rh subsonic:subsonic /tmp/subsonic
mkdir /var/run/subsonic
chown subsonic:subsonic /var/run/subsonic
perl -p -i -e 's/^PIDFILE=\/var\/run\/\$NAME.pid/PIDFILE=\/var\/run\/subsonic\/\$NAME.pid/ ; s/^\ \ \ \ \$DAEMON\ \$DAEMON_ARGS/\ \ \ \ daemon\ --user\ subsonic\ \$DAEMON\ \$DAEMON_ARGS/' /etc/init.d/subsonic

i've also amended /etc/sysconfig/subsonic to include :
--https-port=4041

the log reports :
Subsonic running on: http://localhost:4040/
and: https://localhost:4041/

and everything appears to working ok. there may be flaws in what i have done which i've overlooked but hoping this can be used in future releases :-)

Re: running subsonic as a non privileged user

PostPosted: Sun Apr 15, 2012 1:05 am
by illumilore
can you tell me if what I am missing here, after following the steps for running as non-root user? It still acts as if it is not running as user subsonic.

$ service subsonic start
touch: cannot touch `/var/run/subsonic/subsonic.pid': Permission denied
chown: cannot access `/var/run/subsonic/subsonic.pid': Permission denied
chown: cannot read directory `/var/subsonic': Permission denied
start-stop-daemon: unable to open pidfile /var/run/subsonic/subsonic.pid (Permission denied)

$ ls -l /var/run/ |grep sub
drwxrwxrw- 2 subsonic subsonic 40 2012-04-14 18:58 subsonic
-rw-r--r-- 1 subsonic subsonic 5 2012-04-14 18:15 subsonic.pid

$ cat /etc/default/subsonic | grep USER
SUBSONIC_USER=subsonic

$ ls /var/ -l | grep subsonic
drwxr-x--- 6 subsonic subsonic 4096 2012-04-14 18:15 subsonic

Re: running subsonic as a non privileged user

PostPosted: Sun Apr 15, 2012 9:21 pm
by Carrot Cruncher
hi. the problem i've found on the latest version of fedora is that /var/run is a symbolic link to /run which in turn is a tmpfs and so gets cleared down at boot time. so you need to amend the start function in the init script to check if /var/run/subsonic/ exists and, if not, create it and set the ownership. having said that, this doesn't appear to be your problem and fedora doesn't have /etc/default/subsonic so i've guessing you are running another distro for which the init script is probably different. my solution was only tested on fedora, it will probably need amending for a debian based system. i don't have any debian based systems to test it on i'm afraid.