zoukankan      html  css  js  c++  java
  • 常用权限命令1

    权限命令 chmod(+:增加权限,-:去掉权限,=:赋值权限)
    谁可以修改文件的权限,默认所有者、root

    touch huangpian.list
    默认权限:
    ls -l huangpian.list
    -rw-r--r-- 1 root root 0 5月 19 02:52 huangpian.list
    给用户添加执行权限:
    chmod u+x huangpian.list
    ls -l huangpian.list
    -rwxr--r-- 1 root root 0 5月 19 02:52 huangpian.list

    给所属组增加w权限,其他用户去掉读权限(逗号分隔)
    chmod g+w,o-r huangpian.list
    ls -l huangpian.list
    -rwxrw---- 1 root root 0 5月 19 02:52 huangpian.list

    给其他用户赋值rwx权限
    chmod o=rwx huangpian.list


    权限的数字表示:
    r:4
    w:2
    x:1

    rwxrw-r--
    7 6 4

    chmod 640 huangpian.list
    ls -l huangpian.list
    -rw-r----- 1 root root 0 5月 19 02:52 huangpian.list

    (-R:递归修改)
    mkdir -p a/b(创建目录a/b)
    chmod 777 a (给a目录赋值所有权限)
    ls -ld a (查看a的权限)
    drwxrwxrwx 3 root root 15 5月 19 03:36 a
    ls -ld a/b(查看b的权限)
    drwxr-xr-x 2 root root 6 5月 19 03:36 a/b
    结果:没有递归赋值

    [root@localhost tmp]# chmod -R 777 a
    [root@localhost tmp]# ls -ld a
    drwxrwxrwx 3 root root 15 5月 19 03:36 a
    [root@localhost tmp]# ls -ld a/b
    drwxrwxrwx 2 root root 6 5月 19 03:36 a/b

    权限详细说明:
    对于文件:
    r: cat/more/less/head/tail
    w: vim
    x:script/command
    对于文件夹:
    r:ls
    w:touch/mkdir/rmdir/rm
    x:cd

    如果一个文件普通用户只有读权限 ,但是该文件所在的文件夹具有写权限,那么这个普通用户是可以删除该文件的(文件的删除由文件夹的权限决定)

  • 相关阅读:
    codeforces 814B An express train to reveries
    codeforces 814A An abandoned sentiment from past
    codeforces 785D D. Anton and School
    codeforces 785C Anton and Fairy Tale
    codeforces 791C Bear and Different Names
    AOP详解
    Spring集成JUnit测试
    Spring整合web开发
    IOC装配Bean(注解方式)
    IOC装配Bean(XML方式)
  • 原文地址:https://www.cnblogs.com/javasl/p/11154242.html
Copyright © 2011-2022 走看看