Reputation: 3147
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?
Upvotes: 1
Views: 2302
Reputation: 21
In my Case, this problem happened in Solaris 11 OS. I added privileges to user to use the ports under 1024.
Upvotes: 1
Reputation: 3147
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.
Upvotes: 2
Reputation: 59987
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.
Upvotes: 4