zoukankan      html  css  js  c++  java
  • Linux之文件权限

    现在查看一个文件的信息

    root@ubuntu:/home/songl/test# ls -l a.out 
    -rwxrwxr-x 1 songl songl 8565 May  5 07:45 a.out                                                
    -    rwx  rwx  r-x              1               songl                 songl                 8565 May 5 07:45     a.out   
    文件权限和类型   inode连接数 所有者 所属用户组 时间  文件名
     更改指令chmod    更该指令chown  更该指令chgrp    



    一般来说访问文件的身份有:

    1、文件所有者(owner)

    2、用户组(group)

    3、其它人(others)        

              - rwx rwx r-x
    表示文件    所有者权限   所属用户权限 其它用户权限

      

    改变文件属性的方法:

    1、chgrp    [-R]    dir/file  改变文件所属用户组,加上-R则连同子目录下的所有文件和目录都更新

    2、chown  [-R]    dir/file      改变文件的所有者,加上-R则连同子目录下的所有文件和目录都更新

    3、chomd [-R]  abc dir/file  更改不同使用者的读写执行权限

    root@ubuntu:/home/songl/test# ls -l a.out 
    -rwxrwxr-x 1 songl songl 8565 May  5 07:45 a.out
    root@ubuntu:/home/songl/test# chmod g-w a.out 
    root@ubuntu:/home/songl/test# ls -l a.out 
    -rwxr-xr-x 1 songl songl 8565 May  5 07:45 a.out
    root@ubuntu:/home/songl/test# chown root a.out 
    root@ubuntu:/home/songl/test# ls -l a.out 
    -rwxr-xr-x 1 root songl 8565 May  5 07:45 a.out
    root@ubuntu:/home/songl/test# chgrp root a.out 
    root@ubuntu:/home/songl/test# ls -l a.out 
    -rwxr-xr-x 1 root root 8565 May  5 07:45 a.out
  • 相关阅读:
    ARC和MRC兼容和转换
    ARC下的内存管理
    嵌入式硬件系列一:处理器介绍
    嵌入式Linux GCC常用命令
    一. Linux 下的常用命令
    ARM学习中的必知基本常识
    二叉搜索树详解
    从入门到高手,嵌入式必会技能及学习步骤总结
    史上最全Linux目录结构说明
    排序系列之六:快速排序法进阶
  • 原文地址:https://www.cnblogs.com/be-m/p/4613411.html
Copyright © 2011-2022 走看看