简体   繁体   English

如何使用Java ProcessBuilder以访客或受限用户身份运行可执行文件

[英]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'. 可以说我以admin身份运行,并且具有ac可执行文件“ myProgram.exe”。 I want to execute it using ProcessBuilder in my java program. 我想在Java程序中使用ProcessBuilder执行它。

eg 例如

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

How can I execute 'myProgram.exe' as a less privileged user or guest user? 如何以特权较低的用户或来宾用户身份执行“ myProgram.exe”?

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. 假设该exe(myProgram.exe)尝试删除一些不应删除的文件或执行某些其他活动,然后在特权较低的用户下运行该文件将使其无能为力。

Basically I want to run this 'myProgram.exe' in a jail or with less privileges. 基本上,我想在监狱或更少特权下运行此“ myProgram.exe”。

How can I execute 'myProgram.exe' as a less privileged user programmatically? 如何以特权较低的用户身份以编程方式执行“ myProgram.exe”?

Well, you need a sand box then.. It is an executable that executes another executable in an under-privileged settings.. 好吧,那么您需要一个sand box 。.它是一个可执行文件,可以在权限不足的设置中执行另一个可执行文件。

see here: http://www.sandboxie.com/index.php?StartCommandLine 看到这里: http : //www.sandboxie.com/index.php?StartCommandLine

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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