Problem:
I have a keesail user. I want to have it read and write the local folder permissions should be switched to the root account what commands to give Keesail permissions?
For example, a directory dir, your username Hengyang, you can give users permission to create a directory by executing the following command.
Execute with Root User:
Chown Hengyang.hengyang dir
Answer:
chown-r Keesail:keesail./local
Give Keesail permissions to the local directory
chmod 760./local
Give the local directory read and write permissions to Keesail, the other user does not have any permissions on this directory.
Add:
1. View directory and current file
| The code is as follows |
Copy Code |
[Root@localhost yuechaotian]# pwd /home/yuechaotian [Root@localhost yuechaotian]# LL Total Dosage 8 Drwxr-xr-x 3 root 4096 December 7 14:52 study Drwxr-xr-x 2 root 4096 December 9 21:43 test [Root@localhost yuechaotian]# ll Test Total Dosage 12 -rwxr-xr-x 1 root 11742 December 9 21:43 conf.rd |
2. Users and groups that changed only the directory test did not change the file users and groups under the directory test
| The code is as follows |
Copy Code |
[root@localhost yuechaotian]# chown YUECHAOTIAN:DBA test [Root@localhost yuechaotian]# LL Total Dosage 8 Drwxr-xr-x 3 root 4096 December 7 14:52 study Drwxr-xr-x 2 Yuechaotian dba 4096 December 9 21:43 test [Root@localhost yuechaotian]# ll Test Total Dosage 12 -rwxr-xr-x 1 root 11742 December 9 21:43 conf.rd |
3. Use parameter-r to change directory test and its file users and groups
| code is as follows |
copy code |
| [root@localhost yuechaotian]# chown \ root:root Test [root@localhost yuechaotian]# ll Total usage 8 drwxr-xr-x 3 root root 4096 December 7 14:52 study drwxr-xr-x 2 root root 4096 December 9 21:43 test [root@localhost yuechaotian]# chown-r yuechaotian:dba test [root@localhost Yuechaotia n]# ll Total dosage 8 drwxr-xr-x 3 root root 4096 December 7 14:52 study drwxr-xr-x 2 Yuechaotian dba 4096 December 9 21:43 test [root@localhost yuechaotian]# ll test Total dosage -rwxr-xr-x 1 Yuechaotian dba 11742 December 9 21:43 conf.rd |
The
Use-r parameter in chmod achieves the same effect: All files/folders within the folder are changed to the specified permissions.