For changing users there is "su". Near the top of my (2.x and 3.x) startup scripts I have something like:

   username=`id -un`

   # restart with right user if needed
   if [ "$username" != "$mandatory_user" ]; then
     exec su -c "$0 $*" - $mandatory_user

   # ... rest of

This works well as long as there is only one argument to the script (start, stop, status, -v, etc.) I never figured out how to get the arguments properly escaped for the second round invocation. bash has $@ for that, and to be hones I no longer remember what exactly didn't work right.


Michael Bachers wrote:

I'm running Resin 3.1.0 on Debian and would like to automate Resin startups after a reboot. I'm currently starting Resin as a non-root user on a non-root port, then using iptables to redirect traffic to port 80. I know how to start Resin as root at bootup but am not sure how to do this as non-root.

Anyone doing this?


resin-interest mailing list

resin-interest mailing list

Reply via email to