userdel: user zhoujt is currently used by process 11026 解决方案

linux是多用户系统,root用户具有最高权限,只有root用户才能创建和删除用户,其他用户无此权限。

userdel: user zhoujt is currently used by process 11026 

可见上述报错时因为 zhoujt 这个用户占用了进程,所以使用 userdel zhoujt 命令会报出类似错误。

正确解决方法为:

第一次使用ctrl+d退出root用户,回到zhoujt用户;

第二次使用ctrl+d退出zhoujt用户,此时会返回到root用户(再按ctrl+d退出登陆连接),此时使用userdel zhoujt正常删除。

[root@localhost ~]# userdel zhoujt
userdel: user zhoujt is currently used by process 11026
[root@localhost ~]# su zhoujt
bash-4.2$ exit
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# userdel zhoujt
userdel: user zhou is currently used by process 11026
[root@localhost ~]# 登出
[zhou@localhost root]$ exit
[root@localhost ~]# useradd zhoujt
useradd:用户“zhoujt”已存在
[root@localhost ~]# userdel zhoujt
[root@localhost ~]# cat /etc/passwd
可见用户已成功删除
原文地址:https://www.cnblogs.com/security-guard/p/13673821.html