Modify directory owner (chown) in Linux)
Time:
Source:Unknown
Author:Night e
Click:
903 times
Command name: chown permission: Root usage: chown [-cfhvr] [-- help] [-- version] user [: Group] file... note: Linux/Unix is a multi-person, multi-employee operating system. All files are owned by the owner. Chown can be used to change the owner of an archive.
Command name: chown
Permission: Root
Usage: chown [-cfhvr] [-- help] [-- version] user [: Group] file...
Note: Linux/Unix is a multi-person, multi-employee operating system. All files are owned by the owner. Chown can be used to change the owner of an archive. Generally, this command is only used by the system administrator (Root). Generally, users do not have the permission to change the owner of another user's archive or change their owner to another user. Only the system administrator (Root) has such permissions.
Parameters:
User: User idgroup of the new owner: User Group of the new owner (Group)-C: if the owner of the file has indeed changed, the change action is displayed-F: if the archive owner cannot be changed, do not display the error message-H: only the link is changed, not the file that the link actually points to-V: show owner change details-R: perform the same owner change on all files in the current directory and sub-directories (I .e., change one by one in the way of delivery) -- help: show auxiliary description -- version: display version
Example:
Set the owner of the file file1.txt to user Jessie of the Users Group:
Chown JESSIE: Users file1.txt
Set all files in the current directory and sub-directory owner to user Lamport of Users Group:
Chown-r Lamport: Users *
**************************************** *****************************
**************************************** *****************************
Statement for viewing file permissions:
Enter at the terminal:
Ls-l XXX. XXX (XXX. XXX is the file name)
Then similar information will appear, mainly including:
-RW-r --
A total of 10 digits
The first one indicates the type.
The three RW in the middle represents the owner (user)
Then the three RW-represent the group)
The last three R groups represent other people (other)
Then I will explain the nine digits below:
R indicates that the file can be read)
W indicates that the file can be written)
X indicates that the file can be executed (if it is a program)
-The permission has not been granted.
Now let's talk about modifying file permissions.
Enter at the terminal:
Chmod o + w xxx. XXX
Grant other users the permission to write the file XXX. XXX.
Chmod go-rw xxx. XXX
Deletes the read and write permissions of group groups and other persons in XXX. XXX.
Where:
U stands for the owner (User)
G indicates the group in which the owner is located)
O stands for others, but not u and g (other)
A Represents all people, including U, G, and O
R indicates that the file can be read)
W indicates that the file can be written)
X indicates that the file can be executed (if it is a program)
Rwx can also be replaced by numbers.
R ------------ 4
W ----------- 2
X ------------ 1
------------- 0
Action:
+ Indicates adding permissions.
-Indicates the permission to be deleted.
= Indicates that it is the only permission
After everyone understands the above, we can easily understand the following common permissions:
-RW ------- (600) only the owner has the read and write permissions.
-RW-r -- (644) only the owner has the read and write permissions. The Group and others have only the read permissions.
-Rwx ------ (700) only the owner has the read, write, and execute permissions.
-Rwxr-XR-X (755) only the owner has the read, write, and execute permissions. The Group and others have only the read and execute permissions.
-Rwx -- X (711) only the owner has the read, write, and execute permissions. The Group and others have only the execution permissions.
-RW-(666) everyone has the read and write permissions.
-Rwxrwxrwx (777) everyone has the permission to read and write and execute