As Administrator, when you do a notice that you will some of your users have idle and active ssh session. The idle ssh session could be be due to the hanged ssh session. So the question is how to remove the individual session without killing the active and genuine session.
First thing first, do
# w
You may get some information like this
18:00:35 up 143 days, 19:57, 3 user, load average: 0.03, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
user1 pts/31 :24.0 08Oct11 22days 0.05s 0.05s -bash
user2 pts/24 :30 02Jan11 2days 0.66s 0.66s -bash
user3 pts/55 :17 12Nov10 59days 0.01s 0.01s -bash
To get process id (PID) of the idle session, do the command
# ps -aux | grep 'pts/31'
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 33541 0.0 0.0 61172 776 pts/1 S+ 00:41 0:00 grep pts/31
523 33678 0.0 0.0 64188 1516 pts/31 Ss+ 2012 0:00 -bash
Kill the Process
# kill -9 33678
The idle ssh session has been removed. You can verify with the command "w"
First thing first, do
# w
You may get some information like this
18:00:35 up 143 days, 19:57, 3 user, load average: 0.03, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
user1 pts/31 :24.0 08Oct11 22days 0.05s 0.05s -bash
user2 pts/24 :30 02Jan11 2days 0.66s 0.66s -bash
user3 pts/55 :17 12Nov10 59days 0.01s 0.01s -bash
To get process id (PID) of the idle session, do the command
# ps -aux | grep 'pts/31'
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 33541 0.0 0.0 61172 776 pts/1 S+ 00:41 0:00 grep pts/31
523 33678 0.0 0.0 64188 1516 pts/31 Ss+ 2012 0:00 -bash
Kill the Process
# kill -9 33678
The idle ssh session has been removed. You can verify with the command "w"
No comments:
Post a Comment