Linux file and directory permissions combat
Environment creates two users
user1 and user2
[Email protected] ~]# useradd user1[[email protected] ~]# useradd user2
Create a two folder
[Email protected] ~]# mkdir-p/user1/user2
Open another terminal to switch to su-user1
[Email protected] ~]# Su-user1
Create a user2 file under User2
[Email protected]/]# touch/user2/user2[[email protected]/]# ls-l/user2/user2-rw-r--r--. 1 root root 0 March 01:37/user2/user2
View Permissions
Deleting and moving a file with a parent directory even if the 777 permission is not deleted as long as the parent directory has permissions, even if the file itself is 000 can also be deleted
Even give him 777 privileges.
[Email protected]/]# ls-l/user2/user2-rwxr--rwx. 1 root root 0 March 01:37/user2/user2
[[email protected] user2]$ RM-RF USER2RM: Unable to delete "User2": Insufficient permissions
[Email protected]/]# ls-ld/user2drwxr--rwx. 2 root root 4096 March 01:37/user2
You can move the delete as long as the User2 directory has permissions
User1 Execute Delete command
[Email protected] user2]$ RM-RF user2
You can do it.
This article from "Stick is not Sugar" blog, reprint please contact the author!
Linux file and Directory permissions combat