【问题标题】:How to add user to file permission in Windows Server 2008 R2 with Commad Line如何使用命令行在 Windows Server 2008 R2 中将用户添加到文件权限
【发布时间】:2020-07-30 20:40:17
【问题描述】:

我们正在使用带有 Plesk 的 Windows Server 2008 R2。我们的网站是使用 PHP CodeIgniter 框架开发的。

我们无法从上传的子域读取文件,需要将主域用户名设置为上传的文件,所以我可以手动完成,但我们需要使用命令行来完成,以便我们可以在 PHP 中执行。

有什么帮助吗?谢谢。

【问题讨论】:

    标签: php windows permissions exec windows-server-2008


    【解决方案1】:

    我自己找到了答案,给你;)

    $file_url = "C:\inetpub\vhosts\domain.com\httpdocs\sub.domain.com\uploads\image.jpg";
    $group_username = "example_username";
    exec('icacls '.$file_url.' /grant '.$group_username.':f ');
    

    原始版本:

    exec("icacls C:\inetpub\vhosts\domain.com\httpdocs\sub.domain.com\image.jpg /grant example_username:f");
    

    就是这样。此代码将提供完全控制

    查看更多; https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/icacls

    觉得有用就点个赞吧:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-08
      • 1970-01-01
      • 2018-12-11
      • 1970-01-01
      • 2019-08-10
      • 2012-11-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多