When I try to delete files from my ftp using filezilla I get the following error:

550 image.jpg: Permission denied

The file permissions on this image are 644, tried to change it with something higher but no success...

550 CHMOD 777 image.jpg: Operation not permitted

Tried to delete from plesk panel but the same.

Any ideas? I have a vps hosting with linux/centos.

  • What is the FTP server running on your VPS ? – user9517 Sep 16 '11 at 16:54
  • 1
    Which FTP server are you running, post the configuration file? – quanta Sep 16 '11 at 16:54
  • Most FTP servers I've used have a configuration option to block deletion of files. – DerfK Sep 16 '11 at 20:34
  • The permission of the parent directory is set to 755, however I've created this directory from php using this command "mkdir('/path/to/file', 0777)" but still it's set to 0755. Something strange is happening over my server. The ftp server is ProFTPD. – Levani Sep 17 '11 at 9:10

You don't have permissions to the file. You aren't the owner of the file. Therefore, you cannot remove or change permissions on the file. Try this in a shell:

sudo rm -f image.jpg

| improve this answer | |

When you delete a file, you don't modify that file, but you modify it's parent directory by removing filename->inode correspondence. File may have several names(hardlinks) in single filesystem. When inode link counter becomes 0, inode is freed. So you need to modify permissions for parent directory, not for file.

Second possible case is that in Linux filesystems file may have attributes, which can prevent it from being deleted. See man chattr for details.

| improve this answer | |
  • The permission of the parent directory is set to 755. Can't change it as well... – Levani Sep 17 '11 at 9:11

I found the solution! The problem was caused because I was creating the parent folder of the file using php mkdir function. That folder was creating with the permission 755 regardless what I used as a second parameter for mkdir function. The solution is to add two magic lines before and after the mkdir function, like this:

$old_mask = umask(0);

I don't know exactly what they do but it works now. The parent folder has 777 permission and I can delete any files inside it.

| improve this answer | |

post the

ls -la image.jpg

and try do something like that:

  1. create some file in this dir
  2. delete this file
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.