New Linux users may encounter problems when users are added or deleted in linux.
Problems that new users may encounter when adding or deleting users in Linux
1. After creating a new user, switch to the new user: No directory, logging in with HOME =/
Add User # sudo useradd-m-s/bin/bash-g group loginname-m to create the home directory (if this is not added, manually add the directory, otherwise No directory appears, logging in with HOME =/)-s/bin/bash use bash (the default value is/bin/sh. By default, loginname @ ubuntu is not displayed before $) -g group and then use passwd to change the User Password
2. When deleting a user: userdel: user hbase is currently logged in
Or: userdel: user test is currently used by process 2417 userdel: cannot open/etc/subuid
Many solutions on the Internet are as follows:
$ Mv/var/run/utmp _
$ Touch>/var/run/utmp
About:/var/run/utmp
Utmp is a file. You cannot edit the file except the utmp program. If you delete the file, the current login information will be lost.
This file will be re-created every time the machine is reboot.
However, if I tried it myself, I still got the same prompt.
Delete the user as follows:
$ Userdel-r-f XXXX
Tip: userdel: warning: can't remove/var/mail/git: No such file or directory
Userdel: git home directory (/home/git) not found
But it does not matter. The user has been deleted successfully.
As shown in:
Linux User deletion Problems
This indicates that when you delete a user, it is not completely deleted. There are also some traces of the original user. To completely delete a user, use the following method:
Userdel-r <username>
In linux, how does one delete a user from a group?
To delete a user from a group, follow these steps:
Edit/etc/group, locate the GROUP1 line, and delete
Or use the command
Gpasswd-d A GROUP
Add the following workgroup to existing users:
Usermod-G groupname username
Or: gpasswd-a user group
Reference: blog.sina.com.cn/s/blog_a6dcb5bd01017d0x.html