1

I have a Java application which is running as non root mode.

My App will create a TFTP server (using apache commons tftp). TFTP server is bind to port 69(Default TFTP port). When running the app from IDE everything works fine since the IDE running as root. But if the app is run from other user i get the error

java.net.BindException: Permission denied

It is clear that for non root user i can not open the port. Is there a workaround for this issue?

Stephen Kennedy
21.8k24 gold badges99 silver badges114 bronze badges
asked Mar 22, 2012 at 9:24
3
  • 1
    I think it is not possible. I also tried a lot for this but I could not do it. Commented Mar 22, 2012 at 9:26
  • Oh. I need to port 69 since the third party app will send a file to port 69 :( Commented Mar 22, 2012 at 9:28
  • 3
    Java is not relevant here, this is a much wider issue. See stackoverflow.com/questions/413807/… Commented Mar 22, 2012 at 9:33

3 Answers 3

4

For binding on Linux of ports less that 1024 you need to application to run a root. There is no way around this. If you need to do this you have you run as root. sudo might be the command to look into.

BTW - Running your IDE as root is not a very good idea.

answered Mar 22, 2012 at 9:30
Sign up to request clarification or add additional context in comments.

1 Comment

My device is rooted and the app is in system/priv-app but still can not bind ports less than 1024.
2

To resolve this issue. You can use setuid() and setfid() system calls. So that you can temporarily elevate the permissions and then drop the permission back to user permissions.

Erik Kaplun
38.4k15 gold badges102 silver badges113 bronze badges
answered Apr 25, 2012 at 7:51

Comments

1

In my Case, this problem happened in Solaris 11 OS. I added privileges to user to use the ports under 1024.

https://technicalsanctuary.wordpress.com/2014/06/03/allowing-a-user-to-use-ports-under-1024-on-solaris-11/

answered Oct 8, 2018 at 20:11

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.