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:
The relevant bit is here:
description "Calibre (ebook manager) content server" start on runlevel  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.