I am trying to change the Tomcat's port to 80 in Ubuntu 14.04 through this configuration [conf/server.xml]:

<Connector port="8080" protocol="HTTP/1.1"
           redirectPort="8443" />


<Connector port="80" protocol="HTTP/1.1"
           redirectPort="8443" />

And I am receiving this error:

13-Oct-2015 18:09:10.626 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-nio-80"]
 java.net.SocketException: Permission denied

What I am doing wrong? Or what is missing?



To run Tomcat on a port below 1024 in Ubuntu/Unix, the service needs root privileges. And that you do not want.

Use a port redirection via iptables

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
  • Thank you very much A.B. What are my options then? Oct 13 '15 at 21:40
  • Improved my answer.
    – A.B.
    Oct 14 '15 at 4:51
  • When redirecting using iptables, whenever I send a request to my ip, it automatically adds :8080, is there any way to prevent this?
    – mesut
    Jan 24 '16 at 8:18

Start tomcat services using authbind this will allow user to start ports less than 1024 we do not need to redirect or iptables.

sudo apt-get install authbind -y

To install Authbind software

sudo chmod -R 755 /etc/authbind

group should be user group.

sudo chown -Rh root:group /etc/authbind

After that run the below commands

cd /etc/authbind/byuid

As an example lets imagne user id is 2000 you can use your user id number

sudo echo ',1023' > 2000

That file should be own by user and group.

sudo chown : 2000

sudo chmod 700 2000

Add the below line in tomcat startup file $CATALINA_BASE/startup.sh

export JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"

For Starting tomcat using Authbind service startup.sh

Comment the below line


Add This End as the end of the file

AUTHBIND_COMMAND="/usr/bin/authbind --deep /bin/bash -c " 


now you should be able to start tomcat services as user with less that 1024 ports.

  • echo ',1023' > userName results permission denied
    – mesut
    Jan 24 '16 at 8:28
  • please be root or use sudo
    – PKumar
    Jan 25 '16 at 3:36
  • I used sudo but same error
    – mesut
    Jan 25 '16 at 6:15
  • become root and try
    – PKumar
    Jan 25 '16 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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