-
December 25th, 2010, 02:47 AM
#1
web start program needs root privilege in linux
I wrote a Java program which uses JNI to call functions in a native library (.so in linux).
The native library needs root privilege to access /dev/sdb1.
The program runs fine if we run it with root privilege (sudo ... in ubuntu).
Otherwise, it fails with no privilege error when opening /dev/sdb1.
The problem is that the java program is designed to be a Java web start program.
A non-root user clicks a jnlp link in a web page or double clicks a downloaded jnlp file to start the program. Thus the program fails since no root privilege in linux (ubuntu).
How to solve this problem ?
(? like pop up a dialog and ask the user to enter a password and run the program with root privilege)
-
December 26th, 2010, 05:13 AM
#2
Re: web start program needs root privilege in linux
(? like pop up a dialog and ask the user to enter a password and run the program with root privilege)
I think you have answered your own question.
Once you have the root password you should be able to change to root by using java.lang.ProcessBuilder to create a Process to run the su command.
You will probably have to sign your jar and provide your own security policy to allow the application access to run the process.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|