Linux基础---rhcsa第六次作业--权限设置,Acl权限

1.权限

755-》对应什么权限:-rwxr-xr-x.

600-》对应什么权限:-rw-------.

644-》对应什么权限:-rw-r--r--.

1666-》对应什么权限:-rw-rw-rwT.

7777-》对应什么权限:-rwsrwsrwt.

6000-》对应什么权限:----S--S---.

2.设置权限

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

[root@rhcsa tt]# touch file{1..2}
[root@rhcsa tt]# chmod 611 file1
[root@rhcsa tt]# chmod u+r+w,g+x-r,o-r+x file2
[root@rhcsa tt]# ll
total 0
drwxr-xr-x. 2 root root  6 Dec 21 15:13 dir1
drwxr-xr-x. 2 root root  6 Dec 21 15:13 dir2
-rw---x--x. 1 root root  0 Dec 21 15:15 file1
-rw---x--x. 1 root root  0 Dec 21 15:15 file2
[root@rhcsa tt]# 

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

[root@rhcsa tt]# mkdir dir1
[root@rhcsa tt]# mkdir dir2
[root@rhcsa tt]# chmod 755 dir1
[root@rhcsa tt]# chmod u+r+w+x,g+r+x,o+r+x dir2
[root@rhcsa tt]# ll
total 0
drwxr-xr-x. 2 root root  6 Dec 21 15:13 dir1
drwxr-xr-x. 2 root root  6 Dec 21 15:13 dir2
-rwx--s--x. 1 root root  0 Dec 21 15:10 file
drwxr-xr-x. 3 root root 31 Jun 23 09:02 test1
[root@rhcsa tt]#

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

[root@rhcsa tt]# ll -d file*
-rw---x--x. 1 root root 0 Dec 21 15:15 file1
-rw---x--x. 1 root root 0 Dec 21 15:15 file2
[root@rhcsa tt]# chown rhcsa:rhcsa file*
[root@rhcsa tt]# ll -d file*
-rw---x--x. 1 rhcsa rhcsa 0 Dec 21 15:15 file1
-rw---x--x. 1 rhcsa rhcsa 0 Dec 21 15:15 file2
[root@rhcsa tt]# 

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

[root@rhcsa tt]# touch file{1..2}
[root@rhcsa tt]# chmod 4755 file1
[root@rhcsa tt]# chmod u+s file2
[root@rhcsa tt]# ll -d file*
-rwsr-xr-x. 1 root root 0 Dec 21 15:21 file1
-rwSr--r--. 1 root root 0 Dec 21 15:21 file2
[root@rhcsa tt]# 

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

[root@rhcsa tt]# chmod 6755 file1
[root@rhcsa tt]# chmod g+s file2
[root@rhcsa tt]# ll -d file*
-rwsr-sr-x. 1 root root 0 Dec 21 15:21 file1
-rwSr-Sr--. 1 root root 0 Dec 21 15:21 file2
[root@rhcsa tt]# 

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

[root@rhcsa tt]# chmod 1755 file1
[root@rhcsa tt]# chmod o+t file2
[root@rhcsa tt]# ll -d file*
-rwxr-xr-t. 1 root root 0 Dec 21 15:21 file1
-rwSr-Sr-T. 1 root root 0 Dec 21 15:21 file2
[root@rhcsa tt]# 

7).创建文件,查询文件的acl
为文件设置acl 用户为testuser1 权限为rwx

[root@rhcsa tt]# touch file
[root@rhcsa tt]# ll
total 0
-rw-r--r--. 1 root root 0 Dec 21 15:40 file
[root@rhcsa tt]# getfacl file 
# file: file
# owner: root
# group: root
user::rw-
group::r--
other::r--

[root@rhcsa ~]# setfacl -m u:testuser1:rwx ./tt/file
[root@rhcsa ~]# 

为文件设置acl的mask:权限为r-x
 

[root@rhcsa ~]# cd tt
[root@rhcsa tt]# ls
file
[root@rhcsa tt]# ll
total 0
-rw-rwxr--+ 1 root root 0 Dec 21 15:40 file
[root@rhcsa tt]# setfacl -m m:r-x file 
[root@rhcsa tt]# getfacl file 
# file: file
# owner: root
# group: root
user::rw-
user:testuser1:rwx		#effective:r-x
group::r--
mask::r-x
other::r--

[root@rhcsa tt]# 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值