第六章 管理文件权限

本文详细介绍了Linux系统中文件权限的管理,包括普通权限、特殊权限(如setuid、setgid、t位)以及ACL访问控制列表和SELinux文件上下文。通过实例展示了如何使用chmod、chown和chgrp命令修改权限和所有者,并讨论了umask设定默认权限的作用。还提到了具有setuid权限的文件如`/usr/bin/passwd`如何确保执行者为文件所有者。
摘要由CSDN通过智能技术生成

1.Linux 实现文件权限

1)普通权限

2)特殊权限 理解

3)ACL访问控制列表

4)SELlinux 文件上下文fcontext

5 ) attr权限

普通权限:   r :读   , w: 写(删除)   , x: 执行   数字法表示 :  r: 4   w:2  x:1

创建一个目录/project查看权限:

   [root@server0 /]# 
    [root@server0 /]# mkdir /project
    [root@server0 /]# ls -l /
    total 32
    drwxr-xr-x.   3 root root   20 Jun 15 14:48 backup
    lrwxrwxrwx.   1 root root    7 May  7  2014 bin -> usr/bin
    dr-xr-xr-x.   4 root root 4096 Jul 11  2014 boot
    drwxr-xr-x.  19 root root 3080 Jun 16 09:57 dev
    drwxr-xr-x. 134 root root 8192 Jun 16 12:02 etc
    drwxr-xr-x.   5 root root   44 Jun 16 12:02 home
    lrwxrwxrwx.   1 root root    7 May  7  2014 lib -> usr/lib
    lrwxrwxrwx.   1 root root    9 May  7  2014 lib64 -> usr/lib64
    drwxr-xr-x.   2 root root    6 Mar 13  2014 media
    drwxr-xr-x.   2 root root    6 Mar 13  2014 mnt
    drwxr-xr-x.   3 root root   15 Jul 11  2014 opt
    dr-xr-xr-x. 491 root root    0 Jun 16  2019 proc
    drwxr-xr-x.   2 root root    6 Jun 16 13:48 project

dr-xr-x---.  17 root root 4096 Jun 16 09:50 root
drwxr-xr-x.  36 root root 1180 Jun 16 09:52 run
lrwxrwxrwx.   1 root root    8 May  7  2014 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6 Mar 13  2014 srv
dr-xr-xr-x.  13 root root    0 Jun 16  2019 sys
drwxrwxrwt.   9 root root 4096 Jun 16 13:41 tmp
drwxr-xr-x.  13 root root 4096 May  7  2014 usr
drwxr-xr-x.  23 root root 4096 Jun 16  2019 var
drwxr-xr-x.   2 root root    6 Jun 15 14:25 website
[root@server0 /]# 

d      rwx   r-x    r-x     .     2           root        root         6        Jun 16 13:48 project 
类型  owner  group  other 无acl  硬链接数   所有者 所属组(主组)  大小(字节)  修改时间    文件名

d:目录

l:链接

c:字符

b:块设备

一:普通文件

文件格式:

[root@server0 tmp]# file student-file2
student-file2: empty
[root@server0 tmp]# echo "hello" >> student-file2 
[root@server0 tmp]# file student-file2
student-file2: ASCII text
[root@server0 tmp]# file test.sh 
test.sh: Bourne-Again shell script, ASCII text executable
[root@server0 tmp]# 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值