在linux下创建了用户,发现有问题,想删除重建,结果就遇到了这个问题,网上找解决方法,发现有如下两种方法:
感觉都比较麻烦,既然提示是该用户已经登录,那么将该用户退出登录不就可以了么,测试了一下,果然可以,具体过程如下:
[root@linuxserver ~]# useradd stone
[root@linuxserver ~]# passwd stone
Changing password for user stone.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@linuxserver ~]# su - stone
[stone@linuxserver ~]$ su -
Password:
[root@linuxserver ~]# userdel -r stone
userdel: user stone is currently logged in
[root@linuxserver ~]# logout
[stone@linuxserver ~]$ logout
[root@linuxserver ~]# userdel -r stone
[root@linuxserver ~]# passwd stone
Changing password for user stone.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@linuxserver ~]# su - stone
[stone@linuxserver ~]$ su -
Password:
[root@linuxserver ~]# userdel -r stone
userdel: user stone is currently logged in
[root@linuxserver ~]# logout
[stone@linuxserver ~]$ logout
[root@linuxserver ~]# userdel -r stone
大功告成!