The Computer Oracle

How come one user can delete another user's 755 files?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------


Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT


Music by Eric Matyas
https://www.soundimage.org
Track title: Horror Game Menu Looping

--

Chapters
00:00 How Come One User Can Delete Another User'S 755 Files?
00:44 Accepted Answer Score 64
01:15 Answer 2 Score 12
01:50 Thank you

--

Full question
https://superuser.com/questions/834948/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #security #filepermissions

#avk47



ACCEPTED ANSWER

Score 64


The files are read-only; however, deleting a file doesn't modify it but only the parent directory (it basically removes the file from directory listing) – and it sounds like you have full write permissions to the directory.

You can set the sticky bit—aka “restricted deletion” flag—which will prevent anyone except the owner from renaming or deleting files in that directory (like in /tmp). To do this, run chmod o+t *directory* as the owner of the directory.




ANSWER 2

Score 12


In a typical Unix filesystem, any file can be identified by an arbitrary number of directory entries, each of which holds a "hard link".

From an implementation standpoint there is a difference between deleting the last directory entry (hard link) for a file and simply deleting one reference out of of many. However, from a semantic standpoint there is no difference.

If multiple hard links exist to a file, writing to the file using any of them alters the file seen by all of them. Using rm on a link, however, merely causes the file to not be accessible via that link. Other links to the file continue to see the exact same file.