Linux file owner and group permissions change

    前面带大家认识了怎么创建用户和组,也学习了如何查看权限,今天就来说一说如何修改文件权限。rwx分别是读、写、执行的意思。三位一组,分成三组,如:rwxr-xrw-,分别对应属主,属组和其他人,但是在我们linux中,是不能直接输入中文的命令进行操作的,那我们该怎么办呢?
            其实我们的属主这些都有对应的字母表示,属主--u,属组--g,其他人--o,那我们改权限的时候直接使这些字母就好。
            首先我们先创建一个目录:mkdir dir1

Linux file owner and group permissions change
We have seen that the permissions of the directory dir1 are readable, writable and executable by the owner, readable and executable by the group, and executable by others. Next, we will change the permissions of dir1 so that other people in dir1 have no permissions.
We use chmod or, ox to cancel the permission. chmod (change permissions)
Linux file owner and group permissions change
If we want to add permissions, replace-with +.
In addition to the above method, there is a simpler method, which is a number. Our authority rwx also corresponds to the digital representation, which is easier and more convenient when changing the full authority.
r--4, w--2, x--1, rwx corresponds to 421 in the permissions respectively. Below I will show you how to set permissions using numbers.
chmod 766 dir1 sets the permissions of the directory dir1 to the owner can read, write, and execute, and the owner group and others can read, write, but cannot execute.
Linux file owner and group permissions change
We also need to pay attention to some important files in the company. The permissions must be set up for some important files. A little carelessness will cause unpredictable losses.

Guess you like

Origin blog.51cto.com/14881361/2543832