Ubuntu Authbind Java – Why It Still Fails and How to Fix It

javanetworkingUbuntu

Please, observe:

markk@ip-10-203-82-54:~/work/gl$ uname -a
Linux ip-10-203-82-54 3.2.0-25-virtual #40-Ubuntu SMP Wed May 23 22:20:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
markk@ip-10-203-82-54:~/work/gl$ ls -la /etc/authbind/byport/80
-rwxrwx--- 1 markk markk 0 Aug 16 10:00 /etc/authbind/byport/80
markk@ip-10-203-82-54:~/work/gl$ authbind /usr/bin/java -Dcom.shunra.gl.ports=80 -jar server.jar
java.net.SocketException: Permission denied
        at sun.nio.ch.Net.bind(Native Method)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:137)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:77)
        at org.simpleframework.transport.connect.Acceptor.bind(Acceptor.java:171)
        at org.simpleframework.transport.connect.Acceptor.<init>(Acceptor.java:88)
        at org.simpleframework.transport.connect.Listener.<init>(Listener.java:78)
        at org.simpleframework.transport.connect.ListenerManager.listen(ListenerManager.java:90)
        at org.simpleframework.transport.connect.ListenerManager.listen(ListenerManager.java:73)
        at org.simpleframework.transport.connect.SocketConnection.connect(SocketConnection.java:106)
        at org.restlet.ext.simple.HttpServerHelper.start(HttpServerHelper.java:93)
        at org.restlet.Server.start(Server.java:585)
        at org.restlet.Component.startServers(Component.java:601)
        at org.restlet.Component.start(Component.java:528)
        at com.shunra.gl.Main.main(Unknown Source)
^Cmarkk@ip-10-203-82-54:~/work/gl$

The machine is located in the amazon cloud.

Worth to mention, that when ran as root the server works as expected.

Any ideas?

Thanks.

P.S.

Adding the --deep authbind option or -Djava.net.preferIPv4Stack java property makes no difference.

EDIT

I have installed tomcat6. It listens on port 8080. I can wget its index page locally, but not from the outside using the DNS provided name of the machine. However, if I change its port from 8080 to 11111, then I can get to it from the outside. Which means, that the tomcat server behaves exactly like my own with respect to this issue.

Best Answer

Serverfault may not be the best place for your question since we cannot download the program you are writing and debug it ourselves. You may want to ask your question on stackoverflow.

First: Verify that it's an actual sysadmin-related problem. You can do this by trying to run tomcat which does work in the configuration you're trying.

If you cannot get Tomcat to work, then ask about that- chances are good that solving that problem will solve the one you're having.

On the other hand, if you can get Tomcat to work easily, you can spend more time looking at your application, and maybe try to ask a programming-related question on Stack Overflow.

Related Topic