I have to execute some process as a unprivileged user from my server.Thats my doubt
views:
42answers:
2
+1
A:
Depends on the operating system you you will need to invoke sudo (Linux, *NIX and Mac) or runas (windows)
Edit
Another option use JNA - it basically compiles standard libraries to Java interfaces. I haven't used it, but if you are looking at using OS calls, you may want to explore this.
David Rabinowitz
2009-11-17 06:24:51
runas works only in xp and windows 2000..
Amala
2009-11-17 07:18:43
And on Windows 7...
David Rabinowitz
2009-11-17 08:44:46
A:
In java there's only one way to invoke a process, that is by using Runtime.getRuntime().exec(..). For anything else(privelege, permission, etc...) you may need to use JNI.
Suraj Chandran
2009-11-17 07:24:50
This is not true. Runtime.getRuntime().exec() was superseded/amended by the ProcessBuilder in Java 5 which provides some more convenient methods.
Daniel Schneller
2009-11-17 08:55:44