The CentOS system temporarily disabled a user's method
- 2020-05-13 04:19:10
- OfStack
preface
In the process of using CentOS system, if you do not want to delete the user, but only temporarily or temporarily prohibit a user from logging into the system, you can do this by the following two ways:
1, only the user's record from
/etc/passwd
Remove the file, leaving only its home directory and other files unchanged;
2, in
/etc/passwd
File (or
/etc/shadow
), the first character of the user's passwd field can be preceded by a "*".
Note: this only disables a user. If you want to delete a user, the items you need to delete include:
1.
/etc/passwd
Relevant user records in the file;
2,
/etc/group
Information about the user in the file;
3. The user's home directory, 1 usually under /home;
4. Files created by or belonging to the user.
userdel
The command is used to delete users and their home directories.
The format of the command is:
$ userdel [-r] username
-r
Option: indicates that the user's home directory and its internal files will be deleted.
conclusion
The above is all about the temporary banning of a user in the CentOS system. I hope the content of this article can bring you some help in your study or work. If you have any questions, you can leave a message to communicate.