本地创建了两个账号,text和text1

现在欲删除text1用户,执行如下

[text1@localhost /]$ su text

Password: 

[text@localhost /]$ su 

Password: 

[root@localhost /]# userdel text1

userdel: user text1 is currently used by process 55462

出现了报错,提示text1有程序正在运行,无法删除此用户

那就结束这个用户的所有进程吧

[root@localhost /]# killall -u text1


Session terminated, killing shell...

Session terminated, killing shell...

Session terminated, killing shell...[root@localhost /]#  ...killed.

 ...killed.

 ...killed.

You have new mail in /var/spool/mail/root

[text1@localhost root]$ [text1@localhost /]$ [text1@localhost Desktop]$ 

[root@localhost /]# 

这里本来以为结束成功,于是就进行了下一步,继续删除用户

[root@localhost /]# userdel text1

userdel: user text1 is currently used by process 55462

[root@localhost /]# exit

依旧报错,看来还是没有结束text1用户的进程

刚才不是执行结束进程的命令了吗?仔细回去查了一下返回的信息,发现应该是没有成功

注意到中间有一句话You have new mail in /var/spool/mail/root

查询资料找到了解决办法,切换到root输入

[root@localhost Desktop]# echo "unset MAILCHECK">> /etc/profile

那么继续

[root@localhost Desktop]# killall -u text1

[root@localhost Desktop]# userdel text1

[root@localhost Desktop]# su text

[text@localhost Desktop]$ su

Password: 

[root@localhost Desktop]# su text1

su: user text1 does not exist

大功告成~