Minimum file permissions to delete a file

64,743

If you try to delete a file then the normal file permissions (including ACL and RichACL) do not matter at all. The only relevant attribute to the file itself is the file system attribute immutable, see man lsattr, man chattr.

You need write permission for the direct parent directory and execute permission for all parent directories.

Share:
64,743

Related videos on Youtube

Gilles 'SO- stop being evil'
Author by

Gilles 'SO- stop being evil'

Updated on September 18, 2022

Comments

  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 2 years

    To delete a file in Linux:

    What minimal permissions do we need to set on it?

    What minimal permissions do we need to set on its parent directory?

    • Admin
      Admin about 10 years
      you need write (+w) permissions, and parent directory should be accessible (+x) to the user which is you want to have delete permission.
    • Admin
      Admin about 10 years
      Permissions on the file itself don't matter. You need +wx on the parent directory.