Chmod command, chmod
Chmod -- Modify file or directory permissions
ChAnge the permissionsModE of a file
Command path:/bin/chmod
Note: Only root users and file owners can modify permissions.
Example 1:
# Chmod644/temp/chmodtest
R (read) -- 4
W (write) -- 2
X (execute) -- 1
Execute the above command to modify the chmodtest File Permission In the/temp/directory to-rw-r --
Example 2:
# Chmod-R 777/temp/
The role of the parameter R is to implement recursive modification permissions. Execute the above command to modify the permissions of the/temp/a directory under the current working directory and all its subdirectories and files to-rwxrwxrwx
Raise questions:If the root user creates a directory with 777 permissions and a file with 644 permissions in the directory, can a common user delete files in the directory?
Problem Analysis:
Normal users can delete a file directory because the file directory permission is 777, that is, other users have the write permission on the directory.
Character |
Permission |
Meaning of a file |
Meaning of directory |
R |
Read Permission |
You can view the File Content |
List contents in the directory |
W |
Write Permission |
File content can be modified |
You can create or delete files in the directory. |
X |
Execution permission |
Executable files |
You can enter the Directory |