1、每日課堂筆記總結
2、預習
3、每日課堂pdf練習
4、在/data/testdir里創建的新文件自動屬于g1組,組g2的成員如:alice能對這些新文件有讀寫權限,組g3的成員如:tom只能對新文件有讀權限,其它用戶(不屬于g1,g2,g3)不能訪問這個文件夾。
[root@centos7 /]# groupadd g1
[root@centos7 /]# chown .g1 /testdir/
[root@centos7 /]# chmod g+s /testdir/ //自動屬于g1組
[root@centos7 /]# touch /testdir/tes
[root@centos7 /]# ll /testdir/tes
-rw-r–r–. 1 root g1 0 Aug 3 19:57 /testdir/tes
[root@centos7 /]# groupadd g2
[root@centos7 /]# useradd -G g2 alice
[root@centos7 /]# groupadd g3
[root@centos7 /]# useradd -G g3 tom
[root@centos7 /]# setfacl -d -m g:g3:r– /testdir/
[root@centos7 /]# setfacl -d -m g:g2:rw- /testdir/
[root@centos7 /]# touch /testdir/ccc
[root@centos7 /]# getfacl /testdir/ccc
getfacl: Removing leading '/' from absolute path names
# file: testdir/ccc
# owner: root
# group: g1
user::rw-
group::r-x #effective:r–
group:g2:rw-
group:g3:r–
mask::rw-
other::r–
5、創建組sales,gid 3000,passwd:centos,sales admins:user2
將用戶user1,user2,user3加入到sales輔助組
希望user1 創建新文件 默認的所屬組為sales
user2將用戶user3從sales組移除
刪除sales,user1,user2
[root@centos7 /]# groupadd -g 3000 -p centos sales
[root@centos7 ~]# useradd user2
[root@centos7 /]# gpasswd -A user2 sales
[root@centos7 /]# usermod -G sales user1
[root@centos7 /]# usermod -G sales user2
[root@centos7 /]# usermod -G sales user3
[root@centos7 /]# usermod -g sales user3
[user2@centos7 ~]$ gpasswd -d user3 sales
Removing user user3 from group sales
gpasswd: user 'user3' is not a member of 'sales'
6、三種權限,三種特殊,acl,chattr 總結
見 :文件權限的設置和文件的特殊權限及其命令使用
原創文章,作者:jack_cui,如若轉載,請注明出處:http://www.www58058.com/28341