简体   繁体   English

php创建的文件无法通过FTP删除

[英]Files created by php cannot be deleted through FTP

I have searched the web for possible solutions but it seems to make me more and more stuck. 我在网上搜索了可能的解决方案,但这似乎使我越来越难受。

Once a file is created by PHP that file cannot be deleted, other files in the same directory can be deleted. 用PHP创建文件后,该文件将无法删除,同一目录中的其他文件也可以删除。 If a directory is created by PHP the whole directory cannot be used by FTP, I can see the files in that directory, but cannot delete, modify or upload to this directory. 如果目录是由PHP创建的,则整个目录都不能由FTP使用,我可以看到该目录中的文件,但不能删除,修改或上传到该目录。

I do see a lot of these questions here but mostly they involve permission problems, in this case all permissions, umask and attributes are the same as a file that can be deleted on through FTP. 我确实在这里看到了很多这样的问题,但是大多数问题涉及权限问题,在这种情况下,所有权限,umask和属性都与可以通过FTP删除的文件相同。

I also thought it might be that the file is in use, however this is not the case, (lsof results empty, killing apache and nginx, which normally releases the file did not help either). 我还认为可能是文件正在使用中,但是事实并非如此((lsof结果为空,杀死了apache和nginx,它们通常会释放文件也没有帮助)。

The server is running PLESK 11.0.9 FTP server is ProFTPD. 服务器正在运行PLESK 11.0.9。FTP服务器是ProFTPD。

Is this some limitation that is caused by PHP, PLESK or is it in ProFTPD itself? 这是由PHP,PLESK引起的限制还是在ProFTPD本身中?

I hope you can help me with it, as I'm quite getting frustrated. 我很沮丧,希望您能为我提供帮助。 If you have any questions that might help in answering this question, feel free to ask :). 如果您有任何可能有助于回答此问题的问题,请随时提出:)。

[ EDIT ] Some more details why I think it is not a permission problem. [编辑]我认为这不是许可问题的更多详细信息。

[root@srv domains]# lsattr
-------------e- ./test
-------------e- ./test2

[root@srv domains]# ls -als 
total 32 
4 drwxrwxrwx.  7 user0041 psacln  4096 Mar 22 06:41 . 
4 drwxr-x---. 12 user0041 psaserv 4096 Mar 22 07:28 .. 
4 drwxrwxrwx.  2 user0041 psacln  4096 Mar 22 06:30 test
4 drwxrwxrwx.  2 user0041 psacln  4096 Mar 22 06:34 test2

[root@srv domains]# lsof test
[root@srv domains]#

I cannot do anything with the directory test through ftp, but I can do anything with the directory test2 我无法通过ftp对目录测试执行任何操作,但可以对目录test2执行任何操作

test has been created with mkdir command of php, while test2 has been created through ssh, and has been chowned to the right user. test已使用php的mkdir命令创建,而test2已通过ssh创建,并已被正确的用户使用。

Also I removed some unrelated entries from the outputs 我也从输出中删除了一些不相关的条目

More information about the user proftpd runs when logged in: 登录后,有关用户proftpd的更多信息运行:

[root@srv domains]# ps aux | grep ftp
10000     8508  0.5  0.0 152192  3684 ?        SNs  08:37   0:00 proftpd: user0041 - x: IDLE
[root@srv domains]# cat /etc/passwd | grep 10000
user0041:x:10000:505::/var/www/vhosts/domain.ltd:/bin/false

For privacy matters I have changed the domain name to domain.ltd. 为了保护隐私,我将域名更改为domain.ltd。

Looks like your FTP user doesn't have permissions to delete anything created by the user that PHP is running as. 看来您的FTP用户无权删除运行PHP的用户创建的任何内容。 You'll need to contact your hosting company regarding this. 您需要就此与托管公司联系。

most likely a user permission problem. 最有可能是用户权限问题。 but it could help if you posted some use case with more details describing what exactly are you doing (file names,process,...) 但是如果您发布了一些用例,并提供了更多详细信息来描述您正在做什么(文件名,进程等),这可能会有所帮助。

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

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