File Permission in linux and File Permission in linux
In linux, we found that the linux system has stricter file permission management than windows.
Create a new group in linux: groupadd group name
New linux User: useradd User Name
Create and group users: useradd-g group name Username
View user information: cat/etc/passwd or vi/etc/passwd. The cat command can only be viewed, but has no modification permission. The vi command has both viewing permission, you have the modification permission (that is, the read/write permission)
For example, create two groups: group A and group B.
Create two users: a and B
User a belongs to group A, and user B belongs to Group B.
When user B wants to access user a's files, user a must be given the corresponding permissions.
Command: chmod 777
Then use: ls-l to display
Drwxrwxr-x is a string of such characters. The first character is a file type, and the last three strings indicate the permissions of the current user, the current user, and other users.
W: writable value: 2
R: readable value: 4
X: executable representation value: 1
777 indicates that all users have the permission to read, write, and execute, because 1 + 2 + 4 = 7, right. It is hard to understand ..
To send user B to Group A, you must use usermod-g A B as the administrator.
In linux, how does one change the permissions of a file (command)
Chmod (user permission) (Group permission) (Other permission) File
Permission: r (read) w (write) x (execution) --- numbers 4, 2, and 1 respectively
To grant "User read/write execution permission; group user read permission; other user read permission", run the following command: chmod 622 file:
In linux, the permission for a file is: d
D Indicates directory. in Linux, a file (folder) Permission includes the host permission, group permission, and other permissions, which are divided into three sections, each segment is represented by rwx. r represents read, w represents write, and x represents execution,
For example, a folder has the read and write permissions on its host, and its group has the read and write permissions. Others only have the read permission.
Indicates drwxrw-r --