用户及文件管理习题

[root@localhost Desktop]# groupadd shengchan
[root@localhost Desktop]# groupadd caiwu
[root@localhost Desktop]# groupadd jishu
[root@localhost Desktop]# useradd -g shengchan adminsc
[root@localhost Desktop]# useradd -g caiwu admincw
[root@localhost Desktop]# useradd -g jishu adminjs
[root@localhost Desktop]# useradd -G shengchan tom
[root@localhost Desktop]# useradd -G caiwu harry
[root@localhost Desktop]# useradd -G jishu leo
[root@localhost Desktop]# useradd admin
[root@localhost Desktop]# mkdir /cw /sc /js
[root@localhost Desktop]# chown admincw.caiwu /cw
[root@localhost Desktop]# chown adminjs.jishu /js
[root@localhost Desktop]# chown adminsc.shengchan /sc
[root@localhost Desktop]# chmod 3770 /cw
[root@localhost Desktop]# chmod 3770 /js
[root@localhost Desktop]# chmod 3770 /sc
[root@localhost Desktop]# setfacl -m u:admin:rwx /cw
[root@localhost Desktop]# setfacl -m u:admin:rwx /sc
[root@localhost Desktop]# setfacl -m u:admin:rwx /js

验证:

[root@localhost Desktop]# id adminsc
uid=1006(adminsc) gid=1003(shengchan) groups=1003(shengchan)
[root@localhost Desktop]# id admincw
uid=1007(admincw) gid=1004(caiwu) groups=1004(caiwu)
[root@localhost Desktop]# id adminjs
uid=1008(adminjs) gid=1005(jishu) groups=1005(jishu)
[root@localhost Desktop]# id tom
uid=1002(tom) gid=1006(tom) groups=1006(tom),1003(shengchan)
[root@localhost Desktop]# id harry
uid=1003(harry) gid=1007(harry) groups=1007(harry),1004(caiwu)
[root@localhost Desktop]# id admin
uid=1005(admin) gid=1009(admin) groups=1009(admin)
[root@localhost Desktop]# ls -ld /cw
drwxrws--T+ 2 admincw caiwu 6 Jul 14 16:59 /cw
[root@localhost Desktop]# ls -ld /js
drwxrws--T+ 2 adminjs jishu 6 Jul 14 16:59 /js
[root@localhost Desktop]# ls -ld /sc
drwxrws--T+ 2 adminsc shengchan 6 Jul 14 16:59 /sc
[root@localhost Desktop]# su - admin
[admin@localhost ~]$ cd /cw
[admin@localhost cw]$ exit
logout
[root@localhost Desktop]# su - tom
Last failed login: Sun Jul 14 17:17:07 CST 2019 on pts/2
There was 1 failed login attempt since the last successful login.
[tom@localhost ~]$ cd /cw
-bash: cd: /cw: Permission denied

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值