linux的应用

[root@timi ~]# groupadd g1
groupadd:“g1”组已存在
[root@timi ~]# ll /redhat.txt
ls: 无法访问 '/redhat.txt': 没有那个文件或目录
[root@timi ~]# touch /redhat.txt
[root@timi ~]# chown redhat:g1 /redhat.txt
chown: 无效的用户: “redhat:g1”
[root@timi ~]# touch /redhat.txt
[root@timi ~]# ll /redhat.txt
-rw-r--r--. 1 root root 0  4月 26 20:49 /redhat.txt
[root@timi ~]# usradd redhat
bash: usradd: command not found...
[root@timi ~]# uesradd redhat
bash: uesradd: command not found...
Similar command is: 'useradd'
[root@timi ~]# useradd redhat
[root@timi ~]# chown redhat:g1 /redhat.txt
[root@timi ~]# ll /redhat.txt
-rw-r--r--. 1 redhat g1 0  4月 26 20:49 /redhat.txt
[root@timi ~]# mkdir /sc
[root@timi ~]# groupadd group
[root@timi ~]# chown :group /sc
[root@timi ~]# chmod g+w /sc
[root@timi ~]# ll -d /sc
drwxrwxr-x. 2 root group 6  4月 26 20:52 /sc
[root@timi ~]# chmod 770 /sc
[root@timi ~]# ll -d /sc
drwxrwx---. 2 root group 6  4月 26 20:52 /sc
[root@timi ~]# mkdir /cw
[root@timi ~]# ll -d /sw
ls: 无法访问 '/sw': 没有那个文件或目录
[root@timi ~]# ll -d /cw
drwxr-xr-x. 2 root root 6  4月 26 20:56 /cw
[root@timi ~]# groupadd mygroup
[root@timi ~]# chown :mygroup /cw
[root@timi ~]# ll -d /cw
drwxr-xr-x. 2 root mygroup 6  4月 26 20:56 /cw
[root@timi ~]# chmod g+s /cw
[root@timi ~]# su - zhangsan
[zhangsan@timi ~]$ touch /cw/file1
touch: 无法创建 '/cw/file1': 权限不够
[zhangsan@timi ~]$ exit
注销
[root@timi ~]# chomd g+w /cw
bash: chomd: command not found...
Similar command is: 'chmod'
[root@timi ~]# chmod g+w /cw
[root@timi ~]# su - zhangsan
[zhangsan@timi ~]$ touch /cw/file1
touch: 无法创建 '/cw/file1': 权限不够
[zhangsan@timi ~]$ touch /cw/file1
touch: 无法创建 '/cw/file1': 权限不够
[zhangsan@timi ~]$ 
[zhangsan@timi ~]$ ll
总用量 0
[zhangsan@timi ~]$ exit
注销
[root@timi ~]# su - lisi
[lisi@timi ~]$ touch /cw/file2
touch: 无法创建 '/cw/file2': 权限不够
[lisi@timi ~]$ exit
注销
[root@timi ~]# su - li4
su: user li4 does not exist or the user entry does not contain all the required fields
[root@timi ~]# ll -d
dr-xr-x---. 7 root root 4096  4月 26

[root@timi ~]# su - lisi
[lisi@timi ~]$ ll -d
drwx------. 4 lisi lisi 113  4月 30 11:17 .
[lisi@timi ~]$ ll /cw
总用量 0
[lisi@timi ~]$ ll /cw -d
drwxrwsr-x. 2 root mygroup 6  4月 26 20:56 /cw
[lisi@timi ~]$ gpasswd -M zhangsan,lisi mygroup
gpasswd:没有权限。
[lisi@timi ~]$ exit

[root@timi ~]#  gpasswd -M zhangsan,lisi mygroup
[root@timi ~]# ll /cw -d
drwxrwsr-x. 2 root mygroup 6  4月 26 20:56 /cw
[root@timi ~]# chmod g+s /cw
[root@timi ~]# su - zhangsan
[zhangsan@timi ~]$ touch /cw/file1
[zhangsan@timi ~]$ exit
注销
[root@timi ~]# su - lisi
[lisi@timi ~]$ touch /cw/file2
[lisi@timi ~]$ ll /cw/file1
-rw-r--r--. 1 zhangsan mygroup 0  4月 30 11:31 /cw/file1
[lisi@timi ~]$ exit
注销
[root@timi ~]# ll /cw
总用量 0
-rw-r--r--. 1 zhangsan mygroup 0  4月 30 11:31 file1
-rw-r--r--. 1 lisi     mygroup 0  4月 30 11:32 file2
[root@timi ~]# ll /sc -d
drwxrwx---. 2 root group 6  4月 26 20:52 /sc
[root@timi ~]# useradd helen
[root@timi ~]# setfacl -m u:helen:rwx /sc
[root@timi ~]# setfacl -m u:helen:rwx /cw
[root@timi ~]# su - helen
[helen@timi ~]$ ll /sc
总用量 0
[helen@timi ~]$ ll /cw
总用量 0
-rw-r--r--. 1 zhangsan mygroup 0  4月 30 11:31 file1
-rw-r--r--. 1 lisi     mygroup 0  4月 30 11:32 file2
[helen@timi ~]$ touch /sc/file1
[helen@timi ~]$ touch /cw/file11
[helen@timi ~]$ cd /sc
[helen@timi sc]$ cd /cw
[helen@timi cw]$ cd /
[helen@timi /]$ cd /home
[helen@timi home]$ cd ~
[helen@timi ~]$ exit
注销
[root@timi ~]# mkdir /text
[root@timi ~]# chomd 777 /text/
bash: chomd: command not found...
Similar command is: 'chmod'
[root@timi ~]# chmod 777 /text/
[root@timi ~]# ll -d text/
ls: 无法访问 'text/': 没有那个文件或目录
[root@timi ~]# ll -d /text/
drwxrwxrwx. 2 root root 6  4月 30 11:39 /text/
[root@timi ~]# chmod o+t /text/
[root@timi ~]# su tangyu
[tangyu@timi root]$ cd~
bash: cd~: command not found...
[tangyu@timi root]$ cd ~
[tangyu@timi ~]$ touch /text/2
[tangyu@timi ~]$ ll /text/2
-rw-r--r--. 1 tangyu tangyu 0  4月 30 11:44 /text/2
[tangyu@timi ~]$ su - jay
密码: 
[jay@timi ~]$ touch /text/2
touch: 无法创建 '/text/2': 权限不够
[jay@timi ~]$ touch /text/3
[jay@timi ~]$ ll /text
总用量 0
-rw-r--r--. 1 tangyu tangyu 0  4月 30 11:44 2
-rw-r--r--. 1 jay    jay    0  4月 30 11:45 3
[jay@timi ~]$ su - helen
密码: 
^Hsu: 鉴定故障
[tangyu@timi ~]$ su - root
密码: 
[root@timi ~]# su - helen
[helen@timi ~]$ touch /text/1
[helen@timi ~]$ exit
注销
[root@timi ~]# ll /text
总用量 0
-rw-r--r--. 1 helen  helen  0  4月 30 11:47 1
-rw-r--r--. 1 tangyu tangyu 0  4月 30 11:44 2
-rw-r--r--. 1 jay    jay    0  4月 30 11:45 3
[root@timi ~]# mkdir /text/dir
[root@timi ~]# chmod g+s /text/dir
[root@timi ~]# ll -d /text/dir
drwxr-sr-x. 2 root root 6  4月 30 11:48 /text/dir
[root@timi ~]# chmod o+w /text/dir/
[root@timi ~]# groupadd temp
[root@timi ~]# chown :temp /text/dir/
[root@timi ~]# ll -d /text/dir/
drwxr-srwx. 2 root temp 6  4月 30 11:48 /text/dir/
[root@timi ~]# ll /text/dir/
总用量 0
[root@timi ~]# su jay
[jay@timi root]$ touch /text/dir/1
[jay@timi root]$ ll /text/dir/1
-rw-r--r--. 1 jay temp 0  4月 30 11:54 /text/dir/1
[jay@timi root]$ su - tangyu
密码: 
[tangyu@timi ~]$ touch /text/dir/2
[tangyu@timi ~]$ ll /text/dir/2
-rw-r--r--. 1 tangyu temp 0  4月 30 11:55 /text/dir/2
[tangyu@timi ~]$ su - root
密码: 
[root@timi ~]# touch /text/dir/3
[root@timi ~]# ll /text/dir/3
-rw-r--r--. 1 root temp 0  4月 30 11:56 /text/dir/3

  • 13
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值