使用 chmod 命令设置文件权限(文本和数字表示)

Setting permission of file using chmod command (textual and numeric representations)

问题:

使用chmod将该文件的权限设置为:

• 自己可读、可写、可执行

• 您所属的组可读和可执行。

• 其他用户可读

1) 如果使用文本权限表示方式,chmod命令是什么?

2) 如果使用数字权限表示方式,chmod命令是什么?

我的作品:

  1) chmod u=rwx,g=rx,o=r students.txt  // textual permission representation     
  2) chmod 754 students.txt             // numeric permission representation

评论: 这个回答 1) 和 2) 正确吗?我知道我对 2) 的回答是正确的,因为我使用的是我使用二进制数找到的数值,因此它是数字表示形式。

但是,不确定我对 1) 的回答是否称为 "textual representation",但它使用 'rwx' 字符设置权限,这似乎有点像文本。

我只是想澄清一下我的逻辑是否合理以及我的回答是否正确。

geforce -

您的工作完全正确。方法 1 是使用 chmod 的权限的文本表示。方法2是使用chmod权限的数字表示。