Problems that newbies may encounter when adding users and 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 Create a home directory (do not add this to manually add the directory, otherwise there will be No directory, Logging in with HOME=/) -s /bin/bash Use bash (default is /bin/sh Use default does not appear in front of the $ character login@ubuntu) -g group then use passwd to change the user password 
 2. When deleting the user: userdel: user hbase is currently logged in
 or: userdel: user test Is currently used by process 2417 userdel: can not open /etc/subuid Many online solutions are as follows: $mv /var/run/utmp /var/run/utmp_ $touch > /var/run/utmp About: /var /run/utmp utmp is a file. You can't edit this file except utmp. If you delete it, the current login information will be lost.This file is recreated each time the machine is rebooted. 
 However, I have tried it myself or not, and I still get the same prompt. Then delete the user violently: 
 $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 doesn't matter. The user has actually been successfully deleted.
Copyright © Windows knowledge All Rights Reserved