1, 创建用户 gentoo, 附加组为 bin 和 root, 默认 shell 为 / bin/csh, 注释信息为 "Gentoo Distribution"
useradd -G bin,root -s /bin/csh -c "Gentoo Distribution" gentoo
2, 创建下面的用户, 组和组成员关系 名字为 webs 的组
用户 nginx, 使用 webs 作为附加组
用户 varnish, 使用 webs 作为附加组
用户 MySQL, 不可交互登录系统, 且不是 webs 的成员, nginx,varnish,MySQL 密码都是 magedu
- groupadd webs
- useradd -G webs nginx
- useradd -G webs varnish
- useradd -s /sbin/nologin MySQL
- echo magedu | passwd --stdin nginx &> /dev/null
- echo magedu | passwd --stdin varnish &> /dev/null
- echo magedu | passwd --stdin MySQL &> /dev/null
3, 面试题: 执行 cp /etc/issue /data/dir 所需要的最小权限?
/bin/cp 需要 x 权限
/etc/ 需要 x 权限
/etc/issue 需要 r 权限
/data 需要 x 权限
/data/dir 需要 w,x 权限
4, 当用户 docker 对 / testdir 目录无执行权限时, 意味着无法做哪些操作?
无法进入 / testdir 目录下
5, 当用户 MongoDB 对 / testdir 目录无读权限时, 意味着无法做哪些操作?
无法 ls -a /testdir
6, 当用户 Redis 对 / testdir 目录无写权限时, 该目录下的只读文件? le1 是否可修改和删除?
不可以
7, 当用户 zabbix 对 / testdir 目录有写和执行权限时, 该目录下的只读文件? le1 是否可修改和删除?
可以删除, 但不能修改
8, 复制 / etc/fstab 文件到 / var/tmp 下, 设置文件所有者为 tomcat 读写权限, 所属组为 apps 组有读写权限, 其他人无权限
- chown tomcat.apps /var/tmp/fstab
- chmod 660 /var/tmp/fstab
9, 误删除了用户 Git 的家目录, 请重建并恢复该用户家目录及相应的权限属性
- mkdir /home/Git
- cd /etc/skel
- \cp -r !(..) /home/Git/
- chown -R Git.Git /home/Git
来源: http://www.bubuko.com/infodetail-3644424.html