返回顶部

pzzning

导航

linux 查看、关闭 ssh pts/n登录的用户

1、查看登录用户:

[root@TiaoBan-1 bin]# w
 16:00:11 up 45 days, 21:27,  4 users,  load average: 1.90, 1.75, 1.84
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
eversec  pts/0    102.112.11.113   09:12   27.00s  0.31s  0.01s sshd: eversec [priv]
eversec  pts/1    102.112.11.113   09:12   43.00s  1.49s  0.01s sshd: eversec [priv]
eversec  pts/2    102.112.11.113   16:00    3.00s  0.01s  0.01s sshd: eversec [priv]

2、通知用户:

echo -e '\033[31mI will close your connection!!!\033[0m' >/dev/pts/2

3、关闭用户连接:

fuser -k /dev/pts/2

 

posted on 2017-12-15 16:06  pzzning  阅读(10889)  评论(0编辑  收藏  举报