Learning linux-Basic Five (Rights management exercises)

Source: Internet
Author: User

First, create Group Admins for group Vlan,gid 4000,passwd:centos,vlan admin:vlan2

Adding user vlan1,vlan2,vlan3 to a VLAN secondary group

You want Vlan1 to create a new file the default owning group is VLAN

Vlan2 removing user vlan3 from a VLAN group

[Email protected] testdir]# groupadd-g 4000 VLAN     #创建一个名叫vlan的组
[[email protected] testdir]# useradd-g VLAN vlan1[[email protected] testdir]# useradd-g VLAN vlan2[[email protected] tes tdir]# useradd-g VLAN vlan3     #创建了三个用户都加入到vlan的辅助组中
[Email protected] ~]# groupmems-l-G vlan            #查看在vlan辅助组中的账号vlan1  vlan2  vlan3    
[Email protected] ~]# gpasswd vlanchanging the password for group vlannew password:re-enter New Password: [[email Protec Ted] ~]# gpasswd-a vlan2 vlan          #将vlan2成为vlan组中的管理员 [[email protected] ~]# getent Gshadow vlanvlan:$6$inq7l/hyb0u/$ Bjtdt78t2juknfviflwfquulwe7irvsxlzt21gbbqkhzey2arourenbelf6tvobibia25qlutdmdltatnq4mn0:vlan2:vlan1,vlan2,vlan3
[[email protected] ~]# su vlan2[[email protected] root]$ gpasswd-d vlan3 VLAN      #删除辅助组vlan中的账号vlan3Removing user Vlan3 From group Vlan[[email protected] root]$ exitexit[[email protected] ~]# groupmems-l-G VLAN      Vlan1  

  

 

Second, the new files created in the/testdir/data automatically belong to the G1 Group, group G2 members such as: Alice can have read and write permissions to these new files, group G3 members such as: Alice can have read and write access to these new files, group G3 members such as: Tom can only have read access to the new file, Other users (not part of G1,G2,G3) cannot access this folder.

[[email protected] testdir]# mkdir-p/date/testdir[[email protected] testdir]# Pwd/testdir[[email protected] testdir]# g Roupadd G1[[email protected] testdir]# groupadd g2[[email protected] testdir]# groupadd g3[[email protected] testdir]# CHG RP G1/date/testdir/[[email protected] testdir]# useradd-g G2 alice[[email protected] testdir]# useradd-g G3 tom[[email Protected] testdir]# chmod g+s/data/testdirchmod:cannot access '/data/testdir ': No such file or Directory[[email protect  Ed] testdir]# chmod g+s/date/testdir[[email protected] testdir]# setfacl-rm D:g:g2:rwx/date/testdir/[[email protected] testdir]# getfacl/date/testdir/

  

  

  

  

Learning linux-Basic Five (Rights management exercises)

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.