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
Joined: Mar 22, 2005
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".