centos kick user

 Normally, we first w first, then pkill -kill -t pts/1 (pts/1 is the user terminal number seen by the w command), and we can kick the user, but there is a situation where we can't kick it, that is, the user is Using SSH to jump to other servers, he did not log in directly to ssh.

Memo -. -

[root@jump ~]# userdel ly
userdel: user ly is currently used by process 19789
[root@jump ~]# ps -ef|grep ly
root     19787  2868  0 14:48 ?        00:00:00 sshd: ly [priv]
ly   19789 19787  0 14:48 ?        00:00:00 sshd: ly     
root     20134 18680  0 15:00 pts/4    00:00:00 grep ly
[root@jump ~]# kill 19787 2868 19789
[root@jump ~]# ps -ef|grep ly  
root     20160 18680  0 15:00 pts/4    00:00:00 grep ly
[root@jump ~]# userdel -r ly

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325275356&siteId=291194637