Introduction to a file permission
Linux from the file point of view, the user is divided into owners, groups, other people, three types of users, file permissions are divided into R-readable, W-writable, X-executable three kinds of permissions, and Linux under the new file does not have permission to execute. In Linux, directories and files have different meanings for the rwx permissions they have.
With the Ls-l command, you can view the permissions and owners of the file, others
Two modify file Permissions chmod
1. Command format: chmod {u/g/o/a} {+-=} {r/w/x} File/directory name
2. Command format: chmod num File/directory name (r = 4, W = 2, x = 2)
three modify default permissions Umask
1. View New file default permissions: Umask-s
Umask-s the right to create a new directory, the permissions for new files need to be-X because Linux requires no new files to have executable permissions
2. Modify default New file permissions:
If you want to specify a default permission of Rwx Rx R,
First, compute the RWX rx R's Permission mask: 777-754 = 023
Second: Set default permissions Umask 023
Four modifying owners & owning groups
In Linux, a file can have only one owner and one owning group, and you can view the owner and the owning group of the file through the ls-l command. The default owner of the file is the user who created the file, and the default group for the file is the default group for the user who created the file, that is, the group name for the user group ID in/etc/passwd. The owner of the file and the group to which it belongs can only be executed by the root user. When modified, the file owner and the owning group must exist to do so.
1. Modify file Owner: Chown
Command format: Chown username file name
2. Modify the file belongs to group: Chgrp
Command format: CHGRP username file name