• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Ritesh Badwaik
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!