W
W
wideShift2021-10-02 16:56:14
ubuntu
wideShift, 2021-10-02 16:56:14

Linux permissions on directories are more important than permissions on nested files and folders?

There is a folder created by the current user (not root) with rights (drwxrwxr-x user user1 user1 group),
In the root folder (root user and root group) file 1.txt (-rw-r--r--) is created and directory 2 (drwxr-xr-x).

Through nautilus, I cannot delete its contents in this folder, which is logical, I do not have rights (w) to change the file and directory.

If you go to this folder through the console and execute: rm -rf *
everything is deleted in the folder, while I did not use sudo, what miracles?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2021-10-02
@Rsa97

Permissions on a directory give you the ability to work with the list of files in that directory. You can read this list (r), create, rename and delete files and change directory permissions (w), access files and subdirectories (x).
Permissions on files and subdirectories do not prevent them from being deleted, as long as you have write (w) access to the main directory.

S
Saboteur, 2021-10-03
@saboteur_kiev

File permissions allow you to modify the file itself (change its contents and its permissions).
The rights to the directory allow you to edit the directory - create new files in it, delete existing ones, rename. But, for example, there may not be rights to edit a file in this directory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question