tags:

views:

42

answers:

2

I have to execute some process as a unprivileged user from my server.Thats my doubt

+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
runas works only in xp and windows 2000..
Amala
And on Windows 7...
David Rabinowitz
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
This is not true. Runtime.getRuntime().exec() was superseded/amended by the ProcessBuilder in Java 5 which provides some more convenient methods.
Daniel Schneller