[英]PHP | Powershell | shell_exec() | Not enough permissions
我正在尝试开发一个PHP应用程序,该程序通过shell_exec()执行Powershell命令。
但是,一旦执行了该命令,该命令将失去作用,因为它说它没有权限。 有什么想法我要做什么?
我的代码:
$psscriptpath = "C:\inetpub\htdocs\school_panel\scripts\change.ps1";
$cmdlet = "powershell.exe -executionpolicy remotesigned -File {$psscriptpath} -username {$username} -password {$password} < NUL";
echo $cmdlet;
$output = shell_exec($cmdlet);
echo $output;
出现错误信息:
powershell.exe -executionpolicy remotesigned -File C:\inetpub\htdocs\school_panel\scripts\change.ps1 -username testingacount -password TestingTest321 < NULSet-ADAccountPassword : Access is denied
At C:\inetpub\htdocs\school_panel\scripts\change.ps1:18 char:22
+ Set-ADAccountPassword <<<< $username -NewPassword $newpwd -Reset
+ CategoryInfo : PermissionDenied: (testingacount:ADAccount) [Set-ADAccountPassword], UnauthorizedAccessException
+ FullyQualifiedErrorId : Access is denied,Microsoft.ActiveDirectory.Management.Commands.SetADAccountPassword
我已经尝试过的:
以我能想到的任何方式,允许Web服务器/引擎直接在Shell中运行命令都是一个坏主意。 允许以高特权运行所述命令是一个更糟糕的主意。
来源: http : //www.w3.org/Security/faq/wwwsf3.html (有关详细信息,请参阅Q3。它指的是Unix根用户,但我猜想根启动系统->叉到没人的用户在多个Web服务器之间共享在多个平台上)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.