running subsonic as a non privileged user

Got an idea? Missing something? Post your feature request here.

Moderator: moderators

running subsonic as a non privileged user

Postby Carrot Cruncher » Fri Nov 11, 2011 10:39 am

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.
Carrot Cruncher
 
Posts: 9
Joined: Tue Nov 01, 2011 6:12 pm

Re: running subsonic as a non privileged user

Postby BKKKPewsey » Fri Nov 11, 2011 4:11 pm

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:
Everyone is entitled to be stupid, Image but some abuse the privilege!

Due to the confusion from too many genres of music, we have decided to put both country music and rap music into the genre of Crap music.
User avatar
BKKKPewsey
 
Posts: 2080
Joined: Mon May 23, 2011 12:16 pm
Location: United Kingdom

Re: running subsonic as a non privileged user

Postby Carrot Cruncher » Sat Nov 12, 2011 1:49 pm

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 :-)
Carrot Cruncher
 
Posts: 9
Joined: Tue Nov 01, 2011 6:12 pm

Re: running subsonic as a non privileged user

Postby illumilore » Sun Apr 15, 2012 1:05 am

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
illumilore
 
Posts: 1
Joined: Sun Apr 15, 2012 12:50 am

Re: running subsonic as a non privileged user

Postby Carrot Cruncher » Sun Apr 15, 2012 9:21 pm

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.
Carrot Cruncher
 
Posts: 9
Joined: Tue Nov 01, 2011 6:12 pm


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 2 guests