0
drwxrwxrwx  2 user1 user1 4096 Jun 21 11:25 .
drwxr-xr-x 16 user1 user1 4096 Jun 21 11:25 ..
-rw-r--r--  1 user1 user1   15 Jun 21 11:25 access.txt

The file access.txt is owned by user user1 but the directory has open access to the world (777).

If I log in with user2, I can delete access.txt even though user2 does not have write permissions to it. So does directory permissions take precedence over file permissions? Perhaps that not the best way to describe it, but just looking for a basic explanation here.

CBaker
  • 103

1 Answers1

2

Unlinking access.txt from the directory is not a change to access.txt, but a change to the directory, so user2's write permission on the directory is what is relevant.

The write permission on the file would be of interest if user2 wanted to modify the file, rather than the containing directory.

user4556274
  • 8,995
  • 2
  • 33
  • 37