【问题标题】:How to change the permission mode in Linux?如何在 Linux 中更改权限模式?
【发布时间】:2020-01-29 08:16:03
【问题描述】:

如果是两个命令,则授予所有者读写权限并从组中删除执行权限,

chmod u +rw Test
chmod g -x  Test

或者可以在一个命令中完成吗?

【问题讨论】:

    标签: linux chmod


    【解决方案1】:

    要在 Linux 中更改目录权限,请使用以下命令:

    chmod +rwx filename to add permissions.
    chmod -rwx directoryname to remove permissions.
    chmod +x filename to allow executable permissions.
    chmod -wx filename to take out write and executable permissions.
    

    r: Read permissions. The file can be opened, and its content viewed.
    w: Write permissions. The file can be edited, modified, and deleted.
    x: Execute permissions. If the file is a script or a program, it can be run (executed).
    

    我们也可以更改使用数字 chmod 754 filename 7 个所有者(读写和执行),5 个组(读取和执行),4 个其他用户(只读)

    【讨论】:

      【解决方案2】:
      $ chmod u+rw,g-x Test
      $ ls -ls Test
      0 -rwx-----x 1 dave  dave  0 Sep 30 09:28 Test
      $ chmod -u-rw,g+x Test
      $ ls -ls Test
      0 ------x--- 1 dave  dave  0 Sep 30 09:28 Test
      $ chmod u+rw,g-x Test
      $ ls -ls Test
      0 -rw------- 1 dave  dave  0 Sep 30 09:28 Test
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-12-16
        • 2021-09-18
        • 2011-04-13
        • 1970-01-01
        • 2018-08-03
        • 1970-01-01
        • 1970-01-01
        • 2020-02-07
        相关资源
        最近更新 更多