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、which –skip-alias:跳过别名,直接查看原命令 [root@localhost ~]# which –…

    Linux干货 2016-08-24
  • 第六周作业

    博客具体内容请移步博客园:http://www.cnblogs.com/wangenzhi/p/6295141.html

    Linux干货 2017-01-17
  • 来到马哥的第一天

    找到马哥之后的故事

    Linux干货 2018-03-26
  • find命令之德.摩根定律及perm条件详解

    (1)德.摩根定律        !A -a !B=!( A -o B )        !A -o !B=!( A -a B )        使用条件:条件中存在“非”、“与”…

    Linux干货 2016-08-18
  • SELinux

    软件的安全性 提高软件的安全性 选择安全系数较高的系统 提高现有系统的安全性 计算机的安全等级 D:最低的安全级别,提供最少的安全防护,系统访问无限制。DOS C:访问控制的权限,能够实现可控的安全防护,个人账户管理,审计和资源隔离 Unix Linux windowNT B:支持多级安全,通过硬件对安全数据进行保护 A:最高级别,提供验证设计,要求数据从生…

    Linux干货 2017-05-21
  • 安装Redmine

    Redmine是一个开源的、基于Web的项目管理和缺陷跟踪工具。它用日历和甘特图辅助项目及进度可视化显示。同时它又支持多项目管理。Redmine是一个自由开放源码软件解决方案,它提供集成的项目管理功能,问题跟踪,并为多个版本控制选项的支持。虽说像IBM Rational Team Concert的商业项目调查工具已经很强大了,但想坚持一个自由和开放源码的解决…

    Linux干货 2016-12-01