linux-unit5,6练习题
来源:互联网 发布:北京手机数据恢复公司 编辑:程序博客网 时间:2024/05/20 21:21
1.新建用户组,shengchan,caiwu,jishu
[root@foundation4 Desktop]# groupadd shengchan
[root@foundation4 Desktop]# groupadd caiwu
[root@foundation4 Desktop]# groupadd jishu
2.新建用户要求如下:
*tom是shengchan组的附加用户
[root@foundation4 Desktop]# useradd -G shengchan tom
*harry是caiwu组的附加用户
[root@foundation4 Desktop]# useradd -G caiwu harry
*leo是jishu组附加用户
[root@foundation4 Desktop]# useradd -G jishu leo
*新建admin用户,此用户不属于以上提到的三个部门
[root@foundation4 Desktop]# useradd admin
3.新建目录要求如下:
*/pub目录为公共存储目录对所有用户可以读,写,执行,但用户只能删除属于自己的文件
[root@foundation4 Desktop]# mkdir /pub
[root@foundation4 Desktop]# chmod 1777 /pub
*/sc 目录为生产部存储目录只能对生产部人员可以写入,并且生产部人员所建立的文件都自动归属到shengchan组中
[root@foundation4 Desktop]# mkdir /sc
[root@foundation4 Desktop]# chgrp shengchan /sc
[root@foundation4 Desktop]# chmod 2770 /sc
*/cw目录为财务部存储目录只能对财务部人员可以写入,并且财务部人员所建立的文件都自动归属到caiwu组中
[root@foundation4 Desktop]# mkdir /cw
[root@foundation4 Desktop]# chgrp caiwu /cw
[root@foundation4 Desktop]# chmod 2770 /caiwu
*admin用户能用touch工具在/sc目录和/cw目录中任意建立文件,但不能删除文件。
[root@foundation4 Desktop]# mkdir /sc
[root@foundation4 Desktop]# visudo
编辑:admin foundation4=(root) NOPASSWD: /usr/bin/touch 保存并退出后
[root@foundation4 Desktop]# su - admin ##切换到admin用户
[admin@foundation4 Desktop]$ sudo /usr/bin/touch /sc/file ##admin用户在/sc目录中建立file
4.设定普通用户新建文件权限为"r--r-----"
[root@foundation4 Desktop]# vim /etc/bashrc ##把普通用户的umask修改为226
[root@foundation4 Desktop]# vim /etc/profile ##把普通用户的umask修改为226
[root@foundation4 Desktop]# source /etc/bashrc ##调用
[root@foundation4 Desktop]# source /etc/profile ##调用
[root@foundation4 Desktop]# su - student ##切换普通用户
[student@foundation4 Desktop]$ touch file ##普通用户新建文件
[student@foundation4 Desktop]$ ls -l file ##查看新建的文件
-r--r-----. 1 student student 0 Mar 23 15:48 file
5.设定admin用户可以通过sudo自由建立新用户
[root@foundation4 Desktop]# visudo
编辑:admin foundation4=(root) NOPASSWD: /usr/sbin/useradd 保存并退出后
[root@foundation4 Desktop]# su - admin ##切换到admin用户
[admin@foundation4 Desktop]$ sudo /usr/sbin/useradd stu ##admin用户建立新用户stu
- linux-unit5,6练习题
- unit5-6 练习题
- linux初学 unit5-6 练习
- linux unit5
- Linux Unit5
- linux-基础 unit5
- linux基础unit5
- linux初学 unit5
- Linux基础学习—— unit5.6练习
- Unit5-6 作业练习
- unit5
- unit5
- unit5
- unit5
- Unit5
- Linux学习篇之~unit5
- Linux练习题6
- Linux基础练习题(6)
- 常见的查找算法
- 文章标题
- 远程桌面拷贝文件设置
- 前端学PHP之会话Session
- File 文件类操作
- linux-unit5,6练习题
- mysql: Specified key was too long; max key length is 767 bytes
- byte类型数据范围分析
- ZOJ 3203 Light Bulb
- CentOS7.0+Hadoop2.7.2+Hbase1.2.1搭建教程
- TEXLive2015
- C++中memset()函数的用法详解
- 常用linux命令
- 使用minidom来处理XML的示例(Python 学习)