1、創建用戶gentoo,附加組為bin和root,默認shell為/bin/csh,注釋信息為"Gentoo Distribution"
useradd -G bin,root -s /bin/csh -c "Gentoo Distribution" gentoo
2、創建下面的用戶、組和組成員關系
名字為webs 的組
groupadd webs
用戶nginx 使用webs 作為附屬組
useradd -G webs nginx
用戶varnish,也使用webs 作為附屬組
useradd -G webs varnish
用戶mysql,不可交互登錄系統,且不是webs 的成員,nginx,varnish,mysql密碼都是magedu
useradd -s /sbin/nologin mysql
1.passwd nginx--------magedu
2.echo magedu|passwd --stdin varnish
3.1passwd.txt-----mysql:magedu
3.2cat passwd.txt|chpasswd
https://www.jianshu.com/p/c372f165e658
1、當用戶docker對/testdir 目錄無執行權限時,意味着無法做哪些操作?
rw-:不能cd,短列出文件
2、當用戶mongodb對/testdir 目錄無讀權限時,意味着無法做哪些操作?
-wx:可以進入目錄並可刪除,創建目錄內文件,但不能看見與長列出文件
33、當用戶redis 對/testdir 目錄無寫權限時,該目錄下的只讀文件file1是否可修改和刪除?
r-x:不可以
4、當用戶zabbix對/testdir 目錄有寫和執行權限時,該目錄下的只讀文件file1是否可修改和刪除?
-wx:可以刪除(目錄有寫權限); r--:不可以修改(文件沒有寫權限)
5、復制/etc/fstab文件到/var/tmp下,設置文件所有者為tomcat讀寫權限,所屬組為apps組有讀寫權限,其他人無權限
cp /etc/fstab /var/tmp;useradd tomcat;groupadd apps;chown tomcat:apps /var/tmp/fstab;chmod 660 /var/tmp/fstab
6、誤刪除了用戶git的家目錄,請重建並恢復該用戶家目錄及相應的權限屬性
cp -a /etc/skel/. /home/git;chown -R git:git /home/git;chmod 700 /home/git
cp /etc/skel /home/git -r ;chmod 700 git; chown -R git.git git/
1、在/testdir/dir里創建的新文件自動屬於webs組,組apps的成員如:tomcat能對這些新文件有讀寫權限,組dbs的成員如:mysql只能對新文件有讀權限,其它用戶(不屬於webs,apps,dbs)不能訪問這個文件夾
在/testdir/dir里創建的新文件自動屬於webs組
1.mkdir -pv /testdir/dir
2.groupadd webs
3.chgrp webs /testdir/dir
4.chmod g+s /testdir/dir
組apps的成員如:tomcat能對這些新文件有讀寫權限,組dbs的成員如:mysql只能對新文件有讀權限,其它用戶(不屬於webs,apps,dbs)不能訪問這個文件夾
1.groupadd apps;groupadd dbs
2.useradd -G apps tomcat;useradd -G dbs mysql
3.setfacl -m g:apps:rw /testdir/dir/
4.setfacl -m g:dbs:r /testdir/dir/
5.chmod o= /testdir/dir