Linux can not delete users with urserdel?

  

We all know that Linux can delete users and groups by using the userdel command, but sometimes it will not be deleted. In this case, you can try to use other commands for processing. The following small series will introduce you to Linux. Using userdel can't delete the user's solution.

situation:

Generally, we removed the user is first removed from the group, and then followed the group deleted, but here there is a problem:

root@ www.linuxidc.com :/home/crper# userdel -r test1

userdel: user test1 is currently used by process 1

root@ www.linuxidc.com :/home /crper# groupdel work1

groupdel: Cannot remove the primary group of the user<;test1”

Deleting the user reminds the user that the current process is running, and deleting his group also reports an error.

Solution:

You can use the vipw command:

root@ www.linuxidc.com :/home# vipw

Find the user you created earlier. Delete the line with dd (remember to save: wq or :x).

root@ www.linuxidc.com :/home# vipw -s

Find the group to which the user belongs, and also dd to kill (remember to save: wq or :x)

There is only one reason to use vipw -s, that is, you must ensure the consistency of the data, otherwise it may cause system crashes and other issues.

Command Solution:

root@ www.linuxidc.com :/home# vipw --help

Usage: vipw [options]

Options :

-g, --group Edit group database

-h, --help Display this help and launch

-p, --passwd Edit passwd database< Br>

-q, --quiet Quiet mode

-R, --root CHROOT_DIR chroot to directory

-s, --shadow Edit shadow or gshadow database

The above is the way Linux can not delete users and groups using userdel. This article uses the vipw command instead of the userdel command to delete users. If you want to know more about the usage of the userdel command, see how to use userdel in the Linux home. delete users.

Copyright © Windows knowledge All Rights Reserved