以下Chmod命令的作用是什么



我在下面的页面上遇到了一个命令。http://alblue.bandlem.com/2011/07/setting-up-google-code-with-git.html

chmod go=.netrc

在chmod man中找不到它。

chmod go= .netrc无法访问组和其他人对文件.netrc的访问权限
chmod go=rx .netrc提供读取和执行访问`

基本上,您可以添加+,减去-,并为=分配特定的访问级别。

检查此链接

来自chmod手册页中的"有效模式示例":

go=清除组和其他组的所有模式位。

这意味着"绝对设置这些权限"。在这种情况下,您将清除文件.netrc上的go权限(因为您没有以等号命名任何权限)。

如果你做了这样的事情:

chmod go=r.netrc

您将向groupother授予read权限,但清除go的所有其他权限。

以下是一些例子:

~> pico test.txt <-- Create a file with default permissions
~> ls -l test.txt
-rw-r--r--  1 mike  staff  7 Sep 12 09:39 test.txt
~> chmod go= test.txt <-- Clear the permissions on g and o
~> ls -l test.txt
-rw-------  1 mike  staff  7 Sep 12 09:39 test.txt
~> chmod go=r test.txt <-- Set only read on g and o
~> ls -l test.txt
-rw-r--r--  1 mike  staff  7 Sep 12 09:39 test.txt
~> chmod o=rw test.txt <-- Set read and write only on o
~> ls -l test.txt
-rw-r--rw-  1 mike  staff  7 Sep 12 09:39 test.txt

有关详细信息,请参阅符号模式下的手册页。

最新更新