Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Currently my tomcat is running as root because it does bind to port 80.

I do want to run hudson as a non-root user inside tomcat. How do I do this?

I'm looking for a solution that would not require me to add an apache proxy over tomcat.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

well, only root can bind to ports le 1024. probably there's no mechanism of dropping privs in java/jvm after binding to superuser ports otherwise this would be done by now in tomcat. what i and others did was to keep tomcat listening on a non-privileged port and forward port 80 traffic to that port with a firewall rule.

share|improve this answer
1  
i wasn't exactly right. you may use jsvc to run the workers as a non privileged user. check tomcat.apache.org/tomcat-5.5-doc/setup.html#Unix_daemon –  sysfault Oct 13 '10 at 15:42
add comment

You can forward port 80 to 8080 or any other using iptables, like this:

iptables -t nat -A PREROUTING -p tcp -d second_ip --dport 80 -j REDIRECT --to-port 8080

This is a more generic one, but if you have only one IP remove the destination IP (-d second_ip).

share|improve this answer
add comment

Your Answer

 
discard

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.