aspose file tools
The moose likes Java in General and the fly likes  Runtime.getRuntime().exec(somecommand) -help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark " Runtime.getRuntime().exec(somecommand) -help" Watch " Runtime.getRuntime().exec(somecommand) -help" New topic
Author

Runtime.getRuntime().exec(somecommand) -help

Ritesh Badwaik
Greenhorn

Joined: Feb 23, 2009
Posts: 16
Hi,
I logined as a root in linux . I am using Runtime.getRuntime().exec(somecommand) to execute some command . The command is executed as root(As I logined as root) . How can I execute some command as a particular user(not as a root) ?

Thanks and Regards
Ritesh
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35253
    
    7
You can use the "su" and "sudo" commands to achieve this.

As a general hint, I wouldn't routinely log into a Unix system as root. Use a regular account, and then execute anything that requires higher privileges using "sudo".


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Runtime.getRuntime().exec(somecommand) -help
 
Similar Threads
Where is the InputStream stored...?
Runtime getRuntime() exec(String command) - How does this work?
Retrieving classes of a package
How to Run a command
Executing Unix command from java