简体   繁体   中英

How to run a executable as guest or limited user using java ProcessBuilder

Lets say I'm running as admin and I have ac executable as 'myProgram.exe'. I want to execute it using ProcessBuilder in my java program.

eg

ProcessBuilder pb = new ProcessBuilder("myProgram.exe");
pb.start(); 

How can I execute 'myProgram.exe' as a less privileged user or guest user?

Why I want to do this?

Let say the exe (myProgram.exe) tries to delete some files that it should not delete or perform some other activities, Then running it under a less privileged user will not allow it do above things.

Basically I want to run this 'myProgram.exe' in a jail or with less privileges.

How can I execute 'myProgram.exe' as a less privileged user programmatically?

Well, you need a sand box then.. It is an executable that executes another executable in an under-privileged settings..

see here: http://www.sandboxie.com/index.php?StartCommandLine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM