Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Without getting into proxying, or port redirects, port forwards, etc, is there any native method to bind Resin (a Java server) to port 80, on an Ubuntu server, while Resin is started by root but then operates as an unprivileged user (www-data)?

This is on Ubuntu 10.10, running Resin from the caucho apt repository. I know if I run & operate Resin as root, I can make it use port 80, but as you can imagine, that's not ideal.

share|improve this question
up vote 1 down vote accepted

Found the answer, terminal cmds below. These commands assume you're running Ubuntu 10, and have installed Resin via it's apt repositories. In my case, www-data will be running authbind, with a userid of 33, which you'll see below:

# aptitude install authbind
# nano -w /etc/authbind/byuid/33
# chown www-data. /etc/authbind/byuid/33
# chmod 700 /etc/authbind/byuid/33
# nano -w /etc/init.d/resin

While editing /etc/init.d/resin, find:


Below that, find:

su $USER

Delete that line, replace with:

su $USER -s /usr/local/bin/authbind --deep /bin/bash -c """$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS start""" 1>/dev/null 2>/dev/null



Below that, find:

su $USER

Delete that line, replace with:

su $USER -s /bin/bash -c """$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS shutdown""" 1>/dev/null 2>/dev/null

Write the file & exit (use CTRL+O, CTRL+X)

Now you need to edit resin config:

# nano -w /etc/resin/resin.xml

Make sure that your HTTP port is set to 80 (I believe it is as default, as Resin runs as rot by default), and make sure the following 2 lines are uncommented in the file as well:

www-data www-data

Save & exit (CTRL+O, CTRL+X)

Now start Resin:

# service resin start
share|improve this answer
Found out after all this, that Resin supports running as a user/group natively :-) – Jon L. Dec 5 '10 at 5:46
In resin.xml, just edit the user/group xml tags. Haven't found any issues with that. The procedure above can also be altered and reused for running Tomcat (or TCat) as non-root. – Jon L. Dec 5 '10 at 5:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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