美文网首页
linux 文件权限

linux 文件权限

作者: 小小机器人 | 来源:发表于2016-12-04 18:56 被阅读13次

执行命令ll


  • 当文件类型为[* d* ]则是目录
  • 当文件类型为[* -* ]则是文件;
  • 若文件类型是[* l* ]则表示为链接文档(link file);
  • 若文件类型是[* b* ]则表示为装置文件里面的可供储存的接口设备(可随机存取装置);
  • 若文件类型是[* c* ]则表示为装置文件里面的串行端口设备,例如键盘、鼠标(一次性读取装置)。
权限解释(针对目录):
  • 当某用户拥有某目录r|w|x中任意权限时都可以cd 进入该目录
  • 当某用户只有拥有某目录r权限时才可以在该目录中执行ls等命令
  • 当某用户只有拥有某文件r权限时才可以对该文件执行cat等命令
  • 当某用户只有拥有某目录w权限时才可以对该目录执行rm命令,在该目录中执行touch mkdir rm等命令
  • 当某用户只有拥有某文件w权限时才可以对该文件执行编辑/删除操作
  • 在这里举一个例子:
    某用户拥有某目录的x权限,拥有该目录下某文件的r权限,那么如果现在要cat 该文件,则只能在知道该文件名的情况下才能这么操作,因为在该目录下是不允许read的
[root@localhost tmp]# ll | grep testdir
drwxr-x--x. 2 root  root    4096 Dec  4 14:52 testdir
[root@localhost tmp]# cd testdir/
[root@localhost testdir]# ll 
total 4
-rw-r--r--. 1 root root 15 Dec  4 11:47 test
[xxjqr@localhost tmp]$ ll | grep testdir
drwxr-x--x. 2 root  root    4096 Dec  4 14:52 testdir
[xxjqr@localhost tmp]$ cd testdir/
[xxjqr@localhost testdir]$ ll
ls: cannot open directory .: Permission denied
[xxjqr@localhost testdir]$ cat test
This file is created by the root user
权限修改:
  • u:user
  • g:group
  • o:other
  • a:all
    权限的增加与削减
[root@localhost testdir]# ll
total 4
-r--r--rwx. 1 root root 15 Dec  4 11:47 test
[root@localhost testdir]# chmod ug+x,o-rw test
[root@localhost testdir]# ll
total 4
-r-xr-x--x. 1 root root 15 Dec  4 11:47 test

权限的数字设定

[root@localhost testdir]# ll
total 4
-r-xr-x--x. 1 root root 15 Dec  4 11:47 test
[root@localhost testdir]# chmod 741 test
[root@localhost testdir]# ll
total 4
-rwxr----x. 1 root root 15 Dec  4 11:47 test

修改所属主与所属组
[root@localhost testdir]# ll
total 4
-rwxr----x. 1 root root 15 Dec  4 11:47 test
[root@localhost testdir]# chown xxjqr:xxjqr test #更改文件属主和属组
[root@localhost testdir]# ll
total 4
-rwxr----x. 1 xxjqr xxjqr 15 Dec  4 11:47 test

相关文章

  • 20170724 文件权限

    概要 linux文件权限linux文件特殊权限ACL 访问控制列表 一、linux文件权限 (一)linux文件属...

  • 文件和目录权限

    1、Linux权限介绍2、Linux文件属性3、如何改变Linux文件属性权限4、新建文件默认权限 1、Linux...

  • 获取文件权限

    检测linux下文件的权限 检测linux下多个文件的权限

  • Linux文件权限管理

    Linux文件权限管理 linux文件属性 改变权限 查看用户组

  • linux文件访问权限

    参考 Linux 简单修改权限命令 Linux权限详解 命令之 chmod:修改权限 Linux命令:修改文件权限...

  • linux 权限不完全指南

    Linux 权限概述 本文主要介绍linux的: 文件权限 目录权限 默认权限 umask 隐藏权限 lsattr...

  • 【目录】Linux命令集合

    1、Linux常用20个命令(for me)2、Linux 文件权限含义解析3、Linux 文件/目录权限命令:c...

  • Linux文章集合

    Linux文件权限

  • Linux 文件普通权限

    一、文件权限10个字符对应类型和权限 二、Linux普通文件和Linux目录读、写、执行权限说明 标注:Linux...

  • Linux文件权限

    本篇文章主要介绍Linux文件的权限 在介绍Linux文件权限之前,首先介绍Linux中几种角色 拥有者(owne...

网友评论

      本文标题:linux 文件权限

      本文链接:https://www.haomeiwen.com/subject/wgrhmttx.html