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

   mandatory_user=webserveruser
   username=`id -un`

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

   # ... rest of httpd.sh


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.

-Knut



Michael Bachers wrote:
Hi,

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?

Thanks,
mike


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to