Cyan Blog Cyan Blog
首页
  • Java (opens new window)
  • JUC (opens new window)
  • JVM (opens new window)
  • Redis

    • Redis安装 (opens new window)
    • Redis基础 (opens new window)
    • Redis实战 (opens new window)
    • Redis集群安装 (opens new window)
    • Redis分布式缓存 (opens new window)
    • Redis多级缓存 (opens new window)
    • Redis原理 (opens new window)
  • 管理工具

    • Maven (opens new window)
    • Git (opens new window)
  • SSM

    • Spring (opens new window)
    • SpringBoot (opens new window)
    • Mybatis (opens new window)
    • MybatisPlus (opens new window)
  • 微服务

    • Docker (opens new window)
    • RabbitMQ (opens new window)
    • SpringCloud (opens new window)
    • Dubbo (opens new window)
    • MongoDB (opens new window)
    • Zookeeper (opens new window)
  • Java面试题 (opens new window)
  • JUC面试题 (opens new window)
  • JVM面试题 (opens new window)
  • Linux面试题 (opens new window)
  • SQL面试题 (opens new window)
  • Maven面试题 (opens new window)
  • Redis面试题 (opens new window)
  • SSM面试题 (opens new window)
  • SpringCloud面试题 (opens new window)
  • Linux (opens new window)
  • C++ (opens new window)
  • 数据库

    • MySQL (opens new window)
    • NoSQL (opens new window)
  • 软件测试

    • 软件测试 (opens new window)
  • 加密解密 (opens new window)
  • bilibili字幕提取 (opens new window)
  • 道理 (opens new window)
  • 关于博主

    • Github (opens new window)
    • CSDN (opens new window)
  • 关于本站

    • 如何搭建博客网站 (opens new window)
首页
  • Java (opens new window)
  • JUC (opens new window)
  • JVM (opens new window)
  • Redis

    • Redis安装 (opens new window)
    • Redis基础 (opens new window)
    • Redis实战 (opens new window)
    • Redis集群安装 (opens new window)
    • Redis分布式缓存 (opens new window)
    • Redis多级缓存 (opens new window)
    • Redis原理 (opens new window)
  • 管理工具

    • Maven (opens new window)
    • Git (opens new window)
  • SSM

    • Spring (opens new window)
    • SpringBoot (opens new window)
    • Mybatis (opens new window)
    • MybatisPlus (opens new window)
  • 微服务

    • Docker (opens new window)
    • RabbitMQ (opens new window)
    • SpringCloud (opens new window)
    • Dubbo (opens new window)
    • MongoDB (opens new window)
    • Zookeeper (opens new window)
  • Java面试题 (opens new window)
  • JUC面试题 (opens new window)
  • JVM面试题 (opens new window)
  • Linux面试题 (opens new window)
  • SQL面试题 (opens new window)
  • Maven面试题 (opens new window)
  • Redis面试题 (opens new window)
  • SSM面试题 (opens new window)
  • SpringCloud面试题 (opens new window)
  • Linux (opens new window)
  • C++ (opens new window)
  • 数据库

    • MySQL (opens new window)
    • NoSQL (opens new window)
  • 软件测试

    • 软件测试 (opens new window)
  • 加密解密 (opens new window)
  • bilibili字幕提取 (opens new window)
  • 道理 (opens new window)
  • 关于博主

    • Github (opens new window)
    • CSDN (opens new window)
  • 关于本站

    • 如何搭建博客网站 (opens new window)
  • 设计模式

    • 设计模式
  • 软件测试

  • 软件测试实验

  • 计算机
  • Linux
2025-03-19
223
1
目录
修改用户权限

Linux

# 修改用户权限

  • 符号模式

    • 语法:

      chmod [who][operator][permissions] <文件/目录>
      
      Copied!
    • 添加执行权限:

      chmod +x script.sh
      
      Copied!
    • 移除其他用户的写权限:

      chmod o-w file.txt
      
      Copied!
    • 设置所有用户的读写权限:

      chmod a=rw file.txt
      
      Copied!
  • 数字模式

    • 语法:

      chmod <数字> <文件/目录>
      
      Copied!
    • 每个权限用一个数字表示:

      • 4:读(r)。
      • 2:写(w)。
      • 1:执行(x)。
    • 设置权限为 rwxr-xr--:

      chmod 754 file.txt
      
      Copied!

修改所有者

  • 语法:

    chown <用户> <文件/目录>
    
    Copied!
  • 示例:

    chown alice file.txt
    
    Copied!

修改所属组

  • 语法:

    chgrp <组> <文件/目录>
    
    Copied!
  • 示例:

    chgrp developers file.txt
    
    Copied!

同时修改所有者和所属组

  • 语法:

    chown <用户>:<组> <文件/目录>
    
    Copied!
  • 示例:

    chown alice:developers file.txt
    
    Copied!

默认权限(umask)

  • umask 用于设置新建文件或目录的默认权限。

    • 查看当前 umask:

      umask
      
      Copied!
    • 设置 umask:

      umask 022
      
      Copied!

#

上次更新: 2025/5/2 14:40:28
最近更新
01
md
06-29
02
Redis
06-29
03
HBase
06-29
更多文章>
Theme by Vdoing | Copyright © 2025-2025 Cyan Blog
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式