2019-2020-1 20199326 "Linux kernel principle and Analysis" in the first week of operation

Problem : Adding a user loutest, create a file using sudo / opt / forloutest, set loutest user can read and write.

Solution : First, to add a user loutest, use the adduser or useradd command, you are finished adding users, to create an empty file in the forloutest opt folders can be created with the touch command. But the user does not loutest root privileges, it can not create files in this directory, you need to give permission, then you need to use the usermod command: usermod can be used to modify the set of user accounts. We have to do is to join sudo user loutest group, need to use the -g command usermod: Modify the group the user belongs to. After modifying group is complete, we switch to the user loutest forloutest create an empty file. Then use the chmod command to change file attributes to read and write.
Key Code :

##在shiyanlou用户下
sudo adduser loutest 
sudo usermod -g sudo loutest
su loutest
##在loutest用户下
cd /opt
sudo chmod go+rw forloutest

Operating results :

Guess you like

Origin www.cnblogs.com/funmary/p/11519682.html