8月2日作业

        1、在/data/testdir里创建的新文件自动属于g1组,组g2的成员如:alice能对这些新文件有读写权限,组g3的成员如:tom只能对新文件有读权限,其它用户(不属于g1,g2,g3)不能访问这个文件夹。

[root@localhost testdir]# groupadd g1
[root@localhost testdir]# groupadd g2
[root@localhost testdir]# groupadd g3
[root@localhost testdir]# mkdir -p /date/testdir
[root@localhost testdir]# chmod 770 /date/testdir
[root@localhost testdir]# chown :g1 /date/testdir
[root@localhost testdir]# useradd -G g2 alice
[root@localhost testdir]# useradd -G g3 tom
[root@localhost testdir]# setfacl -Rm g:g2:rwx /date/testdir/
[root@localhost testdir]# setfacl -Rm g:g3:rx /date/testdir/
[root@localhost testdir]# getfacl /date/testdir/
getfacl: Removing leading '/' from absolute path names
# file: date/testdir/
# owner: root
# group: g1
user::rwx
group::rwx
group:g2:rwx     //题目要求读写,没有x权限也不行
group:g3:r-x     //题目要求读权限,如果没有x权限是不能读的
mask::rwx
other::---

2、创建组sales,gid 3000,passwd:centos,sales admins:user2

将用户user1,user2,user3加入到sales辅助组

希望user1 创建新文件 默认的所属组为sales

user2将用户user3从sales组移除

删除sales,user1,user2

[root@localhost ~]# groupadd -g 3000 sales
[root@localhost ~]# gpasswd sales
Changing the password for group sales
New Password: 
Re-enter new password: 
[root@localhost ~]# useradd -G sales user1
[root@localhost ~]# useradd -G sales user2
[root@localhost ~]# useradd -G sales user3
[root@localhost ~]# gpasswd -A user2 sales
[root@localhost ~]# usermod -g sales user1
[root@localhost ~]# su - user1
[user1@localhost ~]$ touch user1.txt
[user1@localhost ~]$ ls -l user1.txt 
-rw-r--r-- 1 user1 sales 0 Jul 25 12:28 user1.txt   //查看user1创建文件默认属组为sales
[user1@localhost ~]$ exit
logout
[root@localhost ~]# su user2
[user2@localhost root]$ gpasswd -d user3 sales
Removing user user3 from group sales
[user2@localhost ~]$ exit
logout
[root@localhost ~]# userdel -r user1     //删除用户
userdel: group user1 not removed because it is not the primary group of user user1.
[root@localhost ~]# userdel -r user2
[root@localhost ~]# groupdel sales

原创文章,作者:Lii,如若转载,请注明出处:http://www.178linux.com/28428

(0)
LiiLii
上一篇 2016-08-05 16:20
下一篇 2016-08-05 21:42

相关推荐

  • 虚拟机的安装

    虚拟机的安装步骤: 1、打开VMware点击创建新的虚拟机 2、选择典型安装方式点击下一步 3、选择稍后安装操作系统点击下一步 4、客户机操作系统选择Linux,版本选择Centos 64位 5、设定虚拟机的名称及存放路径 6、设定磁盘的容量,选中将虚拟磁盘存储为单个文件 7、对虚拟设备进行设置 8、CD/DVD此项选中使用ISO映像文件并选择映像所在路径 …

    2018-03-27
  • Centos系统 本地自动安装

    §·Centos系统光盘安装的流程 大概的了解下Centos的光盘系统安装流程: 1.插入光盘,出现菜单选择界面;通常情况下我们选择第一项: 第一项 : Install  or upgrade an existing system   2.默认进入图形界面安装并且进行一些必要的环境设置(安装前的配置阶段) 需要我们手工设置的项目…

    Linux干货 2016-09-15
  • http://www.jianshu.com/p/f1d0739b141f

    Linux干货 2017-07-30
  • 运维工程师技能需求排行

    这是我今天在拉勾网搜索运维,翻完了4四页也招聘信息之后得到的,我的目的是想要看看之后的学习,哪个更应该成为重点,有些在我意料之中,有些还真的没想到,算是努力了一个小时的收获吧,分享给大家。
    注意:其中的看法仅代表个人观点,很多都是依靠我自己的学习经验和工作经验累积的

    Linux干货 2017-12-12
  • centos6的启动流程和grub实验

    一.centos的启动流程         post–mbr grub 1stage–stage1.5–stage 2 /boot/grub—/boot/grub/grub.conf —kernel /vmlinuz.XXX root=— /boo…

    2017-07-08
  • 配置逻辑卷·设定LVM快照·btrfs文件系统

    _ueditor_page_break_tag_ 配置逻辑卷,设定LVM快照,btrfs文件系统                 逻辑卷管理器( LVM)v允许对卷进行方便操作的抽象层,包括重新设定文…

    Linux干货 2016-09-01