RHSCA第十一天作业

本文详细介绍了在Linux环境中如何创建文件和目录并赋予不同权限,包括使用chmod命令的不同模式(数字与符号)以及设置suid、sgid和sbit标志。此外,还展示了如何设置和查看ACL(Access Control Lists),为特定用户分配额外权限,并调整权限掩码。
摘要由CSDN通过智能技术生成

今日作业:
1.创建文件,并赋予权限611(两种方式,一种guoa,一种nnn)

[root@rhcsa-ma ~]# chmod 755 chom_dir
[root@rhcsa-ma ~]# chmod u=rwx,go=rx chom_dir


2.创建目录,并赋予权限755(两种方式,一种guoa,一种nnn)

[root@rhcsa-ma ~]# chmod 611 chom_dir.txt 

[root@rhcsa-ma ~]# chmod u=rw,go=x chom_dir.txt


3.创建文件,并将文件的属主和属组修改其他用户


4.设置suid,为文件设置suid(两种方式 u+s和nnnn)的方式

[root@rhcsa-ma ~]# chmod u+s chom_test.txt
[root@rhcsa-ma ~]# ll chom_test.txt 
-rwSr--r--. 1 sarah sarah 0 11月 26 00:00 chom_test.txt
[root@rhcsa-ma ~]# chmod u+x chom_test.txt
[root@rhcsa-ma ~]# ll chom_test.txt 
-rwsr--r--. 1 sarah sarah 0 11月 26 00:00 chom_test.txt
[root@rhcsa-ma ~]# chmod 4774 chom_test.txt 
[root@rhcsa-ma ~]# ll chom_test.txt 
-rwsrwxr--. 1 sarah sarah 0 11月 26 00:00 chom_test.txt


5.设置sgid, 为文件设置sgid(两种方式 g+s和nnnn)的方式

[root@rhcsa-ma ~]# chmod g+x chmo_test2
[root@rhcsa-ma ~]# chmod g+s chmo_test2
[root@rhcsa-ma ~]# ls -dl chmo_test2/
drwxr-sr-x. 2 root root 6 11月 26 00:29 chmo_test2/


6.设置sbit,为目录设置sbit(两种方式 o+t和nnnn)的方式

[root@rhcsa-ma ~]# touch chmo_test3
[root@rhcsa-ma ~]# chmod o+x chmo_test3
[root@rhcsa-ma ~]# chmod o+t chmo_test3
[root@rhcsa-ma ~]# ll chmo_test3
-rw-r--r-t. 1 root root 0 11月 26 00:42 chmo_test3
[root@rhcsa-ma ~]# chmod 1645 chmo_test3
[root@rhcsa-ma ~]# ll chmo_test3
-rw-r--r-t. 1 root root 0 11月 26 00:42 chmo_test3


7.创建文件,查询文件的acl
为文件设置acl 用户为testuser1 权限为 rwx
为文件设置acl的mask: 权限为r-x

 

[root@rhcsa-ma ~]# useradd testuser1
[root@rhcsa-ma ~]# touch acl_test01
[root@rhcsa-ma ~]# getfacl acl_test01 
# file: acl_test01
# owner: root
# group: root
user::rw-
group::r--
other::r--


[root@rhcsa-ma ~]# setfacl -m u:testuser1:rwx acl_test01
[root@rhcsa-ma ~]# getfacl acl_test01 
# file: acl_test01
# owner: root
# group: root
user::rw-
user:testuser1:rwx
group::r--
mask::rwx
other::r--


[root@rhcsa-ma ~]# setfacl -m m:r-x acl_test01 
[root@rhcsa-ma ~]# getfacl acl_test01 
# file: acl_test01
# owner: root
# group: root
user::rw-
user:testuser1:rwx		#effective:r-x
group::r--
mask::r-x
other::r--

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值