RHCSA(六)

本文介绍了Linux系统中文件权限的设定,包括755、660、644和6755等模式的含义及其对属主、属组和其他用户的访问权限。通过实例展示了如何使用`chmod`命令创建和修改文件及目录的权限,以及如何改变文件的属主和属组。此外,还演示了如何设置SUID和SGID标志。
摘要由CSDN通过智能技术生成

1.文件权限

755-》对应权限:rwxr-xr-x

该文件的属主用户对该文件的可读可写可执行权限;
该文件的属组用户对该文件的可读可执行权限;
其他所有用户对该文件的可读可执行权限。

660-》对应权限:rw-rw----

该文件的属主用户对该文件的可读可写权限。

644-》对应权限: rw--w--w-

该文件的属主用户对该文件的可读可写权限;
该文件的属组用户对该文件的可读权限;
其他所有用户对该文件的可读权限。

6755-》对应权限:设置SUID和SGID rwxr-xr-x


1664-》对应权限:设置stickyrw-rw--w-

 

2.创建修改

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

[root@localhost ~]# touch chomd_txt1
[root@localhost ~]# ls -l chomd_txt1
-rw-r--r--. 1 root root 0 May 13 06:13 chomd_txt1
[root@localhost ~]# chmod go+x chmod_txt1
[root@localhost ~]# chmod go-r chmod_txt1
[root@localhost ~]# ls -l  chmod_txt1
-rw---x--x. 1 root root 0 May 13 06:09 chmod_txt1
[root@localhost ~]# chmod 611 chmod_txt1
[root@localhost ~]# ls -l  chmod_txt1
-rw---x--x. 1 root root 0 May 13 06:09 chmod_txt1

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

[rhcsa@localhost ~]$ mkdir chmod_dir/
[rhcsa@localhost ~]$ ls -dl chmod_dir/
drwxrwxr-x. 2 rhcsa rhcsa 6 May 13 06:22 chmod_dir/
[rhcsa@localhost ~]$ chmod g-w chmod_dir/
[rhcsa@localhost ~]$ ls -dl chmod_dir/
drwxr-xr-x. 2 rhcsa rhcsa 6 May 13 06:22 chmod_dir/
[rhcsa@localhost ~]$ chmod 755 chmod_dir/
[rhcsa@localhost ~]$ ls -dl chmod_dir/
drwxr-xr-x. 2 rhcsa rhcsa 6 May 13 06:22 chmod_dir/

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

[rhcsa@localhost ~]$ touch chomd_txt2
[rhcsa@localhost ~]$ ls -l chomd_txt2
-rw-rw-r--. 1 rhcsa rhcsa 0 May 13 06:24 chomd_txt2
[rhcsa@localhost ~]$ chown rhcsa:rhcsa chomd_txt2
[rhcsa@localhost ~]$ ls -l chomd_txt2
-rw-rw-r--. 1 rhcsa rhcsa 0 May 13 06:24 chomd_txt2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值