Linux file and Directory permissions combat

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.