本地创建了两个账号,text和text1
现在欲删除text1用户,执行如下
[[email protected] /]$ su text
Password:
[[email protected] /]$ su
Password:
[[email protected] /]# userdel text1
userdel: user text1 is currently used by process 55462
出现了报错,提示text1有程序正在运行,无法删除此用户
那就结束这个用户的所有进程吧
[[email protected] /]# killall -u text1
Session terminated, killing shell...
Session terminated, killing shell...
Session terminated, killing shell...[[email protected] /]# ...killed.
...killed.
...killed.
You have new mail in /var/spool/mail/root
[[email protected] root]$ [[email protected] /]$ [[email protected] Desktop]$
[[email protected] /]#
这里本来以为结束成功,于是就进行了下一步,继续删除用户
[[email protected] /]# userdel text1
userdel: user text1 is currently used by process 55462
[[email protected] /]# exit
依旧报错,看来还是没有结束text1用户的进程
刚才不是执行结束进程的命令了吗?仔细回去查了一下返回的信息,发现应该是没有成功
注意到中间有一句话:You have new mail in /var/spool/mail/root
查询资料找到了解决办法,切换到root输入
[[email protected] Desktop]# echo "unset MAILCHECK">> /etc/profile
那么继续
[[email protected] Desktop]# killall -u text1
[[email protected] Desktop]# userdel text1
[[email protected] Desktop]# su text
[[email protected] Desktop]$ su
Password:
[[email protected] Desktop]# su text1
su: user text1 does not exist
大功告成~