Centos强制关掉其他ssh登录的用户
技术问题
Centos强制关掉其他ssh登录的用户
2024-08-30 09:27
Centos强制关掉其他ssh登录的用户
首先 用who命令查看登录的ip
root pts/0 14.17.65.79 15:30 0.00s 0.05s 0.06s w
root pts/1 183.61.252.34 19:10 12.00s 0.01s 0.01s -bash
然后who am i 查看自己连接的进程
然后就可以删除除自己之外的连接了
pkill -kill -t pts/1
注意:好像杀不死tty1
用ps -t命令可以得到终端的进程号:
ps -t tty1
得到:17093 tty1 00:00:00 bash
说明tty1的进程号是17093
可以用kill杀死:
kill -9 17093
label :
- Centos强制关掉其他ssh登录的用户