0

I have an upstart script that runs a background daemon that I want to run as a specific non-root user.

The script is here:

How To Create a Calibre Ebook Server on Ubuntu

The relevant bit is here:

description "Calibre (ebook manager) content server"

start on runlevel [2345]
stop on runlevel [^2345]

respawn

env USER='myusername'
env PASSWORD='mypassword'
env LIBRARY_PATH='/home/user/calibre-library'
env MAX_COVER='300x400'
env PORT='80'

script
    exec /usr/bin/calibre-server --with-library $LIBRARY_PATH --auto-reload \
                             --max-cover $MAX_COVER --port $PORT \
                             --username $USER --password $PASSWORD
end script

The problem: the calibre-server executable is being run as root. I want the executable itself run as user 'myusername', so that it has the permissions of that user, and not the permissions of root.

0

Add the lines setuid <USER> and setgid <GROUP> to the file. Note that this does not start the process with <USER>'s supplemental groups.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.