zoukankan      html  css  js  c++  java
  • Linux 改变档案属性与权限

    改变所属群组 chgrp

      chgrp -R 组名 文件名

    [root@ ~]# ll用量 22488
    drwxr-xr-x 2 root 1111     4096 5月  15 21:47 demo_test
    drwxr-xr-x 2 root root     4096 3月  18 11:32 docker_demo
    drwxr-xr-x 2 root root     4096 3月  12 10:56 gpu_env
    drwxr-xr-x 3 root root     4096 3月  12 15:15 nvidia
    -rw-r--r-- 1 root root 23010188 12月 24 11:01 Python-3.6.8.tgz
    [root@~]# chgrp -R shen demo_test
    [root@~]# ll
    总用量 22488
    drwxr-xr-x 2 root shen 4096 5月 15 21:47 demo_test
    drwxr-xr-x 2 root root 4096 3月 18 11:32 docker_demo
    drwxr-xr-x 2 root root 4096 3月 12 10:56 gpu_env
    drwxr-xr-x 3 root root 4096 3月 12 15:15 nvidia
    -rw-r--r-- 1 root root 23010188 12月 24 11:01 Python-3.6.8.tgz
    [root@iZj6c1fa4tkhgpvnd9f12rZ ~]# chgrp -R 1111 demo_test

      -R 可以把内部文件递归改变group 组别

    改变文件拥有者 chown

      chown -R 用户名:组名 文件名

    [root@~]# chown -R shen demo_test
    [root@~]# ll
    总用量 22488
    drwxr-xr-x 2 shen 1111     4096 5月  15 21:47 demo_test
    drwxr-xr-x 2 root root     4096 3月  18 11:32 docker_demo
    drwxr-xr-x 2 root root     4096 3月  12 10:56 gpu_env
    drwxr-xr-x 3 root root     4096 3月  12 15:15 nvidia
    -rw-r--r-- 1 root root 23010188 12月 24 11:01 Python-3.6.8.tgz
    [root@~]# chown -R qwer:qwer demo_test
    chown: 无效的用户: "qwer:qwer"
    [root@~]# chown -R root:root demo_test
    [root@~]# ll
    总用量 22488
    drwxr-xr-x 2 root root     4096 5月  15 21:47 demo_test
    drwxr-xr-x 2 root root     4096 3月  18 11:32 docker_demo
    drwxr-xr-x 2 root root     4096 3月  12 10:56 gpu_env
    drwxr-xr-x 3 root root     4096 3月  12 15:15 nvidia
    -rw-r--r-- 1 root root 23010188 12月 24 11:01 Python-3.6.8.tgz
    

      

    改变文档权限

      r  ----4

      w ----2

      x  ----1

      chmod -R 777 文件名

    [root@~]# ll
    总用量 22488
    drwxr-xr-x 2 root root     4096 5月  15 21:47 demo_test
    drwxr-xr-x 2 root root     4096 3月  18 11:32 docker_demo
    drwxr-xr-x 2 root root     4096 3月  12 10:56 gpu_env
    drwxr-xr-x 3 root root     4096 3月  12 15:15 nvidia
    -rw-r--r-- 1 root root 23010188 12月 24 11:01 Python-3.6.8.tgz
    [root@~]# chmod -R 000 demo_test
    [root@~]# ll
    总用量 22488
    d--------- 2 root root     4096 5月  15 21:47 demo_test
    drwxr-xr-x 2 root root     4096 3月  18 11:32 docker_demo
    drwxr-xr-x 2 root root     4096 3月  12 10:56 gpu_env
    drwxr-xr-x 3 root root     4096 3月  12 15:15 nvidia
    -rw-r--r-- 1 root root 23010188 12月 24 11:01 Python-3.6.8.tgz
    [root@~]# chmod -R 730 demo_test
    [root@~]# ll
    总用量 22488
    drwx-wx--- 2 root root     4096 5月  15 21:47 demo_test
    drwxr-xr-x 2 root root     4096 3月  18 11:32 docker_demo
    drwxr-xr-x 2 root root     4096 3月  12 10:56 gpu_env
    drwxr-xr-x 3 root root     4096 3月  12 15:15 nvidia
    -rw-r--r-- 1 root root 23010188 12月 24 11:01 Python-3.6.8.tgz
    

      

  • 相关阅读:
    Java技术之ThreadLocal的使用
    find and find_by
    vim-config
    把字符串当做js代码执行的方法
    lodop打印设计
    前端使用lodop如何获取打印状态
    lodop第三方插件的使用
    nodejs中http服务器,如何使用GET,POST请求发送数据、npm、以及一些插件的介绍
    nodejs 用http模块搭建的服务器的路由,以及路由代码的重构过程
    nodejs基础 用http模块 搭建一个简单的web服务器 响应JSON、html
  • 原文地址:https://www.cnblogs.com/Stay-J/p/10872534.html
Copyright © 2011-2022 走看看