DEV Community

Discussion on: Everything you need to know about Creating files in LINUX-Based Operating Systems

Collapse
 
pinotattari profile image
Riccardo Bernardini

Users should have permissions to create a file on the parent folder.

This recalls to my mind something that usually surprises the beginner: in order to delete a file you need to have write permission on the folder, not on the file. Yes, you can remove read-only files as long as you can write the folder; removing a file requires writing on the parent folder, not on the file itself.

Said this, it should also be said that the command 'rm' asks for confirmation if you try to delete a read-only file.