Temporarily disabling a user in CentOS
How to temporarily disable a user in CentOS is to temporarily prevent the user from using the Linux system, rather than deleting it.
You can achieve this through the following two methods:
1. only remove the user's records from the/etc/passwd file, and keep the user's home directory and other files unchanged;
2. In the/etc/passwd file (or/etc/shadow), add a "*" before the first character of the passwd field of the user.
Note: This only disables a user. To delete a user, you need to delete the following items:
1. Related user records in the/etc/passwd file;
2. the user information in the/etc/group file;
3. the user's home directory is generally in the/home Directory;
4. files created by or belonging to the user.
The userdel command is used to delete users and their home directories.
Command Format:
$ Userdel [-r] username
-R option: indicates that the user's home directory and its internal files will be deleted.