posted 17 years ago
Hi Guys,
From Java,I want to change the current user to "su",providing the password as well under linux.Do some tasks and go back to the last user.
For example,I tried something as follows which didnt work!
String cmd[]={"su","password"};
Runtime.getRuntime().exec(cmd);
Finish some tasks with the super user like deleting some files
Go back to the previous user.
//
String cmd[]={"Exit"};
Runtime.getRuntime().exec(cmd);
These are the commands normally used on a Linux shell command.How to do it from a java program.I use Java5.
Thanks
P