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?
-
1I think it is not possible. I also tried a lot for this but I could not do it.Ravindra Gullapalli– Ravindra Gullapalli2012年03月22日 09:26:17 +00:00Commented Mar 22, 2012 at 9:26
-
Oh. I need to port 69 since the third party app will send a file to port 69 :(Dheeraj Joshi– Dheeraj Joshi2012年03月22日 09:28:12 +00:00Commented Mar 22, 2012 at 9:28
-
3Java is not relevant here, this is a much wider issue. See stackoverflow.com/questions/413807/…skaffman– skaffman2012年03月22日 09:33:42 +00:00Commented Mar 22, 2012 at 9:33
3 Answers 3
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.
1 Comment
system/priv-app but still can not bind ports less than 1024.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.
Comments
In my Case, this problem happened in Solaris 11 OS. I added privileges to user to use the ports under 1024.