权限作业1

[root@love ~]# groupadd g1
[root@love ~]# touch redhat.txt
[root@love ~]# chown redhat:g1 /redhat.txt
chown: 无法访问 '/redhat.txt': 没有那个文件或目录
[root@love ~]# chown redhat:g1 redhat.txt
[root@love ~]# ll redhat.txt
-rw-r--r--. 1 redhat g1 0  4月 26 17:48 redhat.txt
[root@love ~]# mkdir /sc
[root@love ~]# groupadd group
[root@love ~]# chown root:group /sc
[root@love ~]# ll /sc
总用量 0
[root@love ~]# ll -d /sc
drwxr-xr-x. 2 root group 6  4月 26 17:49 /sc
[root@love ~]# setfacl u:root:rwx /sc
Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...
Try `setfacl --help' for more information.
[root@love ~]# setfacl -m u:root:rwx /sc
[root@love ~]# setfacl -m g:group:rwx /sc
[root@love ~]# getfacl /sc
getfacl: Removing leading '/' from absolute path names
# file: sc
# owner: root
# group: group
user::rwx
user:root:rwx
group::r-x
group:group:rwx
mask::rwx
other::r-x

[root@love ~]# chmod  770 /sc
[root@love ~]# ll -d /sc
drwxrwx---+ 2 root group 6  4月 26 17:49 /sc
[root@love ~]# mkdir /cw
[root@love ~]# useradd caiwurenyuan
[root@love ~]# groupadd mygroup
groupadd:“mygroup”组已存在
[root@love ~]# gpasswd -a caiwurenyuan mygroup
正在将用户“caiwurenyuan”加入到“mygroup”组中
[root@love ~]# chmod 770 /cw
[root@love ~]# setfacl -m g:mygroup:rwx /cw
[root@love ~]# useradd helen
[root@love ~]# userdel helen
[root@love ~]# useradd -g group -G mygroup helen
useradd: warning: the home directory /home/helen already exists.
useradd: Not copying any file from skel directory into it.
正在创建信箱文件: 文件已存在
[root@love ~]# ^C
[root@love ~]# ^C
[root@love ~]# rm -rf helen
[root@love ~]# useradd -g group -G mygroup helen
useradd:用户“helen”已存在
[root@love ~]# grep helen /etc/gpasswd
grep: /etc/gpasswd: 没有那个文件或目录
[root@love ~]# grep helen /etc/passwd
helen:x:10094:10095::/home/helen:/bin/bash
[root@love ~]# mkdir /test
[root@love ~]# chmod 777 /test
[root@love ~]# ll -d /test
drwxrwxrwx. 2 root root 6  4月 26 18:03 /test
[root@love ~]# groupadd temp
[root@love ~]# chown  root:temp /test
[root@love ~]# cd /test
[root@love test]# touch /dir
[root@love test]# rm -rf /dir
[root@love test]# touch dir
[root@love test]# ll -d dir
-rw-r--r--. 1 root root 0  4月 26 18:07 dir
[root@love test]# cd ..
[root@love /]# cd ..
[root@love /]# cd ~
[root@love ~]# chown root:temp /test/dir
[root@love ~]# ll -d /test/dir
-rw-r--r--. 1 root temp 0  4月 26 18:07 /test/dir
[root@love ~]# cd /test/dir
-bash: cd: /test/dir: 不是目录
[root@love ~]# rm -rf /test/dir
[root@love ~]# cd /test
[root@love test]# cd ~
[root@love ~]# mkdir /test/dir
[root@love ~]# chown  root:temp /test/dir
[root@love ~]# touch /test/dir/ceshi
[root@love ~]# ll -d /test/dir/ceshi
-rw-r--r--. 1 root root 0  4月 26 18:14 /test/dir/ceshi
[root@love ~]# chmod g+s /test/dir/ceshi
[root@love ~]# ll
总用量 312
drwxr-xr-x. 2 root   root      6  1月 24 12:33 -
drwxr-xr-x. 3 root   root     15  1月 24 12:27 1
-rw-r--r--. 1 root   root     27  4月  1 19:52 12
-rw-r--r--. 1 root   root      0  1月 24 12:37 1aA
-rw-r--r--. 1 root   root      0  1月 24 12:37 1aA_copy
drwxr-xr-x. 2 root   root      6  4月 26 17:46 公共
drwxr-xr-x. 2 root   root      6  4月 26 17:46 模板
drwxr-xr-x. 2 root   root      6  4月 26 17:46 视频
drwxr-xr-x. 2 root   root      6  4月 26 17:46 图片
drwxr-xr-x. 2 root   root      6  4月 26 17:46 文档
drwxr-xr-x. 2 root   root      6  4月 26 17:46 下载
drwxr-xr-x. 2 root   root      6  4月 26 17:46 音乐
drwxr-xr-x. 2 root   root      6  4月 26 17:46 桌面
-rw-r--r--. 1 root   root      0  1月 24 12:41 a
-r--r--r--. 1 root   root    377  4月 18 16:56 access.log
-rw-------. 1 root   root    946  1月 22 12:30 anaconda-ks.cfg
-rw-r--r--. 1 root   root      0  1月 24 12:35 d
-rw-r--r--. 1 root   root      0  1月 24 12:35 e
-rw-r--r--. 1 root   root     55  4月 18 16:02 erro.file
drwxr-xr-x. 2 root   root     38  4月 18 15:41 etc
-rw-r--r--. 1 root   root    824  4月 11 18:16 file
-rw-r--r--. 2 root   root      4  4月  1 18:16 filel2
-rw-r--r--. 2 root   root      4  4月  1 18:16 filel3
-rw-r--r--. 1 root   root    341  4月 18 16:27 files
-rw-r--r--. 1 root   root    176  4月 20 11:12 file.txt
drwxr-xr-x. 2 root   root      6  4月 18 16:04 haha
-rw-r--r--. 1 root   root     34  4月 12 19:07 haha01.gz
-rw-r--r--. 1 root   root     34  4月 12 19:08 haha02.gz
-rw-r--r--. 1 root   root     34  4月 12 19:09 haha03.gz
drwxr-xr-x. 3 root   root     18  4月 18 15:48 me
-rw-------. 1 root   root 140498  4月 18 15:42 messages
-rw-r--r--. 1 root   root  23219  4月 18 15:46 me.tar.bz2
-rw-r--r--. 1 root   root     55  4月 18 16:04 nell
-rw-r--r--. 1 root   root   1856  4月 18 16:04 NELL
-rw-r--r--. 1 root   root   1756  4月 18 16:01 ok.file
-rw-r--r--. 1 root   root   2106  4月 12 18:11 passwd
drwxr-xr-x. 3 root   root     19  4月 12 18:55 passwd5
-rw-r--r--. 1 root   root   2106  4月 12 18:11 passwd7
-rw-r--r--. 1 redhat g1        0  4月 26 17:48 redhat.txt
drwxr-xr-x. 3 root   root     33  4月 18 15:47 root
-rw-r--r--. 1 root   root     69  4月 11 18:26 test.txt
-rw-r--r--. 1 root   root      0  1月 24 14:06 tmp
-rw-r--r--. 1 root   root  22922  1月 31 14:24 top.txt
-rw-r--r--. 1 root   root  10240  4月 12 19:24 vj
-rw-r--r--. 1 root   root     16  4月 18 16:06 xixi
lrwxrwxrwx. 1 root   root      4  4月 18 16:07 xixi.link2.0 -> xixi
drwxr-xr-x. 2 root   root     20  4月 12 18:55 yasuo
-rw-r--r--. 1 root   root  10240  4月 12 19:30 yasuo1.tar
drwxr-xr-x. 3 root   root     50  4月 12 19:33 yasuo2.0
-rw-r--r--. 1 root   root  10240  4月 12 19:33 yasuo2.tar
-rw-r--r--. 1 root   root  10240  4月 12 19:28 z
[root@love ~]# ll -d /test/dir/ceshi
-rw-r-Sr--. 1 root root 0  4月 26 18:14 /test/dir/ceshi
[root@love ~]# touch /test/dir/ceshi2
[root@love ~]# ll -d /test/dir/ceshi2
-rw-r--r--. 1 root root 0  4月 26 18:17 /test/dir/ceshi2
[root@love ~]# chmod 777 /test/dir
[root@love ~]# chmod g+s /test/dir
[root@love ~]# touch /test/dir/ceshi4
[root@love ~]# ll -d /test/dir/ceshi4
-rw-r--r--. 1 root temp 0  4月 26 18:18 /test/dir/ceshi4
[root@love ~]# Sticky o+t /test
bash: Sticky: command not found...
[root@love ~]# shmod o+t /test
bash: shmod: command not found...
Similar command is: 'chmod'
[root@love ~]# chmod o+t /test
[root@love ~]#

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值