Search code examples
phpftpfile-permissionschmod

Can not change permissions on FTP for files created with PHP copy


I have a script that uses the copy function of PHP to copy files to my server. When I log into my server via FTP I can't delete them anymore, as the permissions are set to 644. But when I try to change the permissions directly at the FTP, I get a "Operation not permitted" error.

NOOP
200 NOOP command successful
SITE CHMOD 777 /test2/2016-07-19/13739536_1750492681870132_416621053_n.jpg
550 CHMOD 777 /test2/2016-07-19/13739536_1750492681870132_416621053_n.jpg: Operation not permitted

Normally I can change the permissions on my server without any problems. Via SSH it is also not working. Does it have to do something with the permissions of the original file?

Thanks for your help!


Solution

  • PHP script is a different user than the one that is logging in through FTP.

    Either change the permisions of the file using another php script or log in as root through SSH.