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
  • 相关阅读:
    Python面试
    PyCharm快捷键
    PyCharm安装及使用
    Python环境搭建
    MYSQL的cmake编译单实例安装
    lamp和lnmp环境的搭建
    模拟解决DOS攻击的shell脚本
    责任链模式
    迭代器模式
    备忘录设计模式
  • 原文地址:https://www.cnblogs.com/be-m/p/4613411.html
Copyright © 2011-2022 走看看