1. Add Users
AddUser test
2. Change the password
passwd test
3. Delete a user
Userdel Test
or delete it along with the user directory
Userdel-f Test
Note: If the user is still logged in, it will prompt that the user is logged in cannot be deleted. You may need to force the user to exit first.
4. Mandatory exit already logged in user
View currently logged in user
# W
USER TTY from [email protected] IDLE jcpu PCPU
Root pts/0 ***.**.***.** 11:33 0.00s 0.08s 0.00s W
tmp_3254 PS1 ***.**.***.** 11:33 0.00s 0.08s 0.00s ls
Command prototype: pkill-kill-t [TTY]
Pkill-kill-t PS1
Repeat the second step of the delete user command to delete the success.
5. Modify the User directory
First finger username
, use the command to view the user's original directory
Finger:command not found
Solve
Rpm-qa |grep Fingeryum Install finger
Enter to id username
view user uid
ID username
Modify the user home directory
usermod-d/usr/newfolder-u UID Username
-u
You have to pick uid
it up later.username
After the modification is complete, finger username
you can check for changes before and after changes.
CentOS Add User