Menu

#83 Run as other user than root

closed
None
5
2014-02-27
2013-04-05
Andrew Peng
No

Make minidlna run as another other than root. Requires some simple modifications to the init.d script and default location of PID file

Discussion

  • Andrew Peng

    Andrew Peng - 2013-04-05

    PID file modification:
    Default PID location since /var/run isn't writable by world / unprivileged user:
    change from:
    /var/run/minidlna.pid

    to:
    /var/run/minidlna/minidlna.d

    init.d script modification
    change the default pid location:
    PIDFILE=/var/run/minidlna/minidlna.pid
    ARGS="-f $CONF -P $PIDFILE"

    Change start-stop-daemon to start daemon as unprivileged user:
    USER=nobody
    start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --startas $MINIDLNA -- $ARGS $LSBNAMES

     
  • Joe

    Joe - 2014-02-27

    In my setup the original 1.1.1 release works fine.
    in /etc/minidlna.conf I set user=nobody

    I do not use the init.d/start-stop-daemon script (I built a simple rc.minidlnad for slackware), but as far as I see, all is working as designed.

    I'm not sure what version you are using, but in minidlnad 1.1.1 the pid file is located at /var/run/minidlna/minidlna.pid . By simply setting the username in the conf file, minidlnad runs as that user after setting up the required files as root.

    Although your option may have worked in the past, LAUNCHING MINIDLNAD as any user other than root doesn't seem to be the best approach. The program needs to create files/directories and sockets as root, then it DROPS ITSELF to the appropriate user.

    I would consider this request closed- you can run as another user, and the pid file is generated/deleted correctly.

     
  • Justin Maggard

    Justin Maggard - 2014-02-27
    • status: open --> closed
    • assigned_to: Justin Maggard
    • Group: --> Next Release (example)
     

Log in to post a comment.