用戶、用戶組相關練習題

1 、創建用戶gentoo,附加組爲bin和root,默認shell爲/bin/csh ,註釋信息爲"GentooDistribution"

   [root@centos7 ~]# useradd -G bin,root -s/bin/csh -c "Gentoo Distribution" gentoo

2 、創建下面的用戶、組和組成員關係

名字爲爲admins 的組

[root@centos7 ~] #groupadd admins

  用戶natasha,使用admins 作爲附屬組

[root@centos7 ~] #useradd –G admins natasha

 用戶harry ,也使用admins作爲附屬組

[root@centos7 ~] #useradd –G admins Harry

  用戶sarah ,不可交互登錄系統,且不是admins的成員,

   [root@centos7~] #useradd –s /sbin/nologin sarah

   用戶natasha harry sarah 密碼都是centos

   [root@centos7~] #passwd  natasah

3、在/data/testdir 裏創建的新文件自動屬g1組,組g2的成員如:alice 能對這些新文件有讀寫權限,組g3的成員如:tom只能對新文件有讀權限,其它用戶(不屬於g1,g2,g3 )不能訪問這個文件夾

[root@centos7 ~]# mkdir -p /data/testdir 注意data目錄是在根目錄下,而不是在當前家目錄下

[root@centos7 data]# chown .g1 testdir

[root@centos7 data]# chmod g+s testdir

[root@centos7 data]# useradd -G g2 alice

[root@centos7 data]# setfac l -m d:g:g2:rwX testdir

[root@centos7 data]# useradd -G g3 tom

[root@centos7 data]# setfac l -m d:g:g3:rX testdir

[root@centos7 data]# chmod o= testdir僅不能切進去,而且不能查看其內文件列表信息


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章