Hi,
I've made a simple app in the NetBeans IDE to make your usb stick a little safer. It uses the windows cacls command to edit acls. This would deny access to a folder.
There is only one problem.
On a normal user account, it returns the error: Permission denied. (or something, I translated it from Dutch)
I don't know why I get this error. At the command prompt, normal user do have permission to run the cacls command.
My app doesnt seem to have the rights to execute this command.
cacls function:
private void unlock(String file,String user){
String s = null;
try {
String[] command = {"cacls" , file , "/E" , "/G" , user + ":F" };
Process p = Runtime.getRuntime().exec(command);
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));
// read the output from the command
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
// read any errors from the attempted command
while ((s = stdError.readLine()) != null) {
System.out.println(s);
}
}
catch (IOException e) {
System.out.println("Exception: ");
e.printStackTrace();
}
}
This function gives permission to the file 'file' for the user/usergroup 'user'.
Running as administrator isn't really an option. This app is ment to be used at school and I don't think I'm gonna get the admin password..
Somebody help me please :D
Thanks in advance