Linux如何修改权限模式?

How to change the permission mode in Linux?

向所有者授予读写权限并从组中删除执行权限应该是两个命令,

chmod u +rw Test
chmod g -x  Test

或者可以用一条命令完成吗?

$ 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

要更改 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个(只读)