简体   繁体   English

无法在Perl中使用mkdir创建文件夹,权限被拒绝?

[英]Can't create folder using mkdir in perl, permission denied?

I'm trying to create a directory with a perl script after calling it via Ajax through a web interface. 在通过Web界面通过Ajax调用目录之后,我试图用perl脚本创建目录。 I'm using IIS7.5 to run my webserver. 我正在使用IIS7.5运行我的Web服务器。

The problem arises when I use either mkdir($path) or system("mkdir", $path) , with the errors being "Permission denied" or "Access is denied", respectively. 当我使用mkdir($path)system("mkdir", $path) ,分别出现错误,分别是“权限被拒绝”或“访问被拒绝”。 I believe I've set up the permissions correctly to give read/write/execute permissions as well as special permissions to create files and folders to the script. 我相信我已经正确设置了权限,以赋予读/写/执行权限,以及为脚本创建文件和文件夹的特殊权限。

Please let me know also if this should should be posted elsewhere, thanks! 还请让我知道是否应该在其他地方发布此信息,谢谢!

I would think you could find the user running the script with "whoami". 我认为您可以找到使用“ whoami”运行脚本的用户。

Also, I'm not clear on what context the script is running in, nor where is the directory it is trying to create. 另外,我不清楚脚本在哪个上下文中运行,也不清楚它试图在哪里创建目录。 It might be necessary to add the "-p" option so that necessary parent directories are created. 可能需要添加“ -p”选项,以便创建必要的父目录。

No comment on the safety of this ... I assume that those checks are being made elsewhere. 对此安全性无可奉告。我认为这些检查正在其他地方进行。

Please keep in mind that , the folder that you are planning to create this new folder in , must be owned by apache ( or any other web server software, you might be using ). 请记住,您计划在中创建此新文件夹的文件夹必须归apache拥有(或您可能正在使用的任何其他Web服务器软件)。

sudo chown apache *rootfolderfornewfolder*

I hope this helps 我希望这有帮助

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

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