1

I know there is a question like this already, but it was confusing question and answer, and I think this should be simple

I am testing deleting a file and I have two users admin_ftpuser works, delebash does not. sudo delebash works fine.

Here are the group user belongs to and file permissions via command groups:

admin_ftpuser : admin

delebash sudo admin

File and Folder permissions via command ls -l

drwxr-x--x 2 admin admin 4096 Aug 27 08:37 public_html

then file underneath public_html called robots.txt

-rw-rw-r-- 1 admin admin 65 Aug 26 23:35 robots.txt

If I login via ftp with user admin_ftpuser and try to delete robots.txt it works If I login via ftp with user delebash and try to delete robots.tx it does not, delebash has access to the directory and can write to it but not delete

I have also tried shell access via ssh with user delebash with the same results admin_ftpuser does not have a user directory nor shell access as ssh is limited to key authentication, but ftp login for both users work fine.

I used VestaCP to setup the admin_ftpuser and I manually added delebash user, but I don't understand if they both are in admin group and admin group has rw on robots.txt why admin_ftp user can delete and delebash cannot.

I know I can change ownership but I do not want to do that, I want users that belong to admin group to be able to do the same thing as admin_ftpuser

I have logged out and in again and rebooted.

1
  • How about the rights of the admin group on the directory in which the file is stored? Should have write permission if I am not mistaken myself.
    – Marco
    Aug 27, 2015 at 13:31

1 Answer 1

3

Deleting a file requires write permission on the directory. This is because you are actually modifying the directory when you delete the file (You don't even need permissions on the file to delete it if you can write in the directory, you'll just receive a warning about deleting a write-protected file).

You just need to give the group write permissions on the directory.

Your question is a duplicate of this https://superuser.com/questions/373115/why-cant-i-delete-a-file-where-i-have-group-write-permissions-on

1
  • thank you both @Marco, that worked and I did not see the duplicate you listed
    – dan
    Aug 27, 2015 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .