Re: kill a stale user session?

2012-08-05 Thread David Diggles
Try this?

ps aux|fgrep acheng@ttyp3

On Mon, Aug 06, 2012 at 10:56:00AM +0800, Alan Cheng wrote:
 Hello all,
 
 I'd like to kill an stale user session, but could not find a way to do
 that. Seems like there is no process attached to that ttyp4 any more. It's
 an OpenBSD 5.1 on i386, by the way.
 
 Any advice appreciated.
 
 some output, more will be provided if necessary.
 
 #w
  7:44PM  up 12 days, 23:19, 2 users, load averages: 0.10, 0.14, 0.18
 USERTTY FROM  LOGIN@  IDLE WHAT
 acheng   p0 180.116.63.38 6:00PM 0 w
 acheng   p4 114.227.123.110  27Jul12 9days -
  -- the one I'd like to kill
 
 
 #ps -t p4
   PID TT  STAT   TIME COMMAND
 
 
 thanks.
 acheng



Re: kill a stale user session?

2012-08-05 Thread David Diggles
On Mon, Aug 06, 2012 at 01:38:27PM +1000, David Diggles wrote:
 Try this?
 
 ps aux|fgrep acheng@ttyp3


ps aux|fgrep acheng@ttyp4

do you get the sshd process id you can kill?


 On Mon, Aug 06, 2012 at 10:56:00AM +0800, Alan Cheng wrote:
  Hello all,
  
  I'd like to kill an stale user session, but could not find a way to do
  that. Seems like there is no process attached to that ttyp4 any more. It's
  an OpenBSD 5.1 on i386, by the way.
  
  Any advice appreciated.
  
  some output, more will be provided if necessary.
  
  #w
   7:44PM  up 12 days, 23:19, 2 users, load averages: 0.10, 0.14, 0.18
  USERTTY FROM  LOGIN@  IDLE WHAT
  acheng   p0 180.116.63.38 6:00PM 0 w
  acheng   p4 114.227.123.110  27Jul12 9days -
   -- the one I'd like to kill
  
  
  #ps -t p4
PID TT  STAT   TIME COMMAND
  
  
  thanks.
  acheng



Re: kill a stale user session?

2012-08-05 Thread Alan Cheng
Got nothing from  ps aux|fgrep acheng@ttyp4. No SSHD process to kill
either.

The problem for me is that no process belongs to ttyp4, but w still
reports an idle session.

FYI:
$ ps aux|fgrep acheng@ttyp4

$ w
 9:57PM  up 13 days,  1:31, 3 users, load averages: 0.16, 0.18, 0.23
USERTTY FROM  LOGIN@  IDLE WHAT
acheng   p0 180.116.63.38 6:00PM  1:50 -ksh
acheng   p1 114.227.120.208:06PM 0 w
acheng   p4 114.227.123.110  27Jul12 9days -

$ ps aux | grep ksh
acheng   13452  0.0  0.1   548   500 p0  Is 6:00PM0:00.02 -ksh (ksh)
root 25705  0.0  0.1   632   528 p0  I+ 6:07PM0:00.07 -ksh (ksh)
acheng   30721  0.0  0.1   480   488 p1  Ss 8:06PM0:00.02 -ksh (ksh)
acheng   28924  0.0  0.0   480 4 p1  R+ 9:57PM0:00.00 -ksh (ksh)

$ ps aux | grep sshd
root 16212  0.0  0.2   656  1208 ??  Is23Jul120:04.01
/usr/sbin/sshd
root 30292  0.0  0.5  3456  2812 ??  Is 6:00PM0:00.07 sshd:
acheng [priv] (sshd)
acheng9594  0.0  0.7  4724  3612 ??  I  6:00PM0:02.20 sshd:
acheng@ttyp0 (sshd)
root 22538  0.0  0.5  3428  2828 ??  Is 8:06PM0:00.06 sshd:
acheng [priv] (sshd)
acheng   18141  0.0  0.6  3880  2920 ??  S  8:06PM0:02.19 sshd:
acheng@ttyp1 (sshd)

Thanks for the response.

acheng

On Mon, Aug 6, 2012 at 11:42 AM, David Diggles da...@elven.com.au wrote:

 On Mon, Aug 06, 2012 at 01:38:27PM +1000, David Diggles wrote:
  Try this?
 
  ps aux|fgrep acheng@ttyp3


 ps aux|fgrep acheng@ttyp4

 do you get the sshd process id you can kill?


  On Mon, Aug 06, 2012 at 10:56:00AM +0800, Alan Cheng wrote:
   Hello all,
  
   I'd like to kill an stale user session, but could not find a way to do
   that. Seems like there is no process attached to that ttyp4 any more.
 It's
   an OpenBSD 5.1 on i386, by the way.
  
   Any advice appreciated.
  
   some output, more will be provided if necessary.
  
   #w
7:44PM  up 12 days, 23:19, 2 users, load averages: 0.10, 0.14, 0.18
   USERTTY FROM  LOGIN@  IDLE WHAT
   acheng   p0 180.116.63.38 6:00PM 0 w
   acheng   p4 114.227.123.110  27Jul12 9days -
-- the one I'd like to kill
  
  
 
   #ps -t p4
 PID TT  STAT   TIME COMMAND
  
  
   thanks.
   acheng



Re: kill a stale user session?

2012-08-05 Thread David Diggles
http://marc.info/?l=openbsd-miscm=104862612011751w=2
---
List:   openbsd-misc
Subject:Re: Can't disconnect ghost SSH session from days ago
From:   Mathieu Sauve-Frankel m.sauve () secureops ! com
Date:   2003-03-25 20:59:44

man utmp

This ghost user is merely a stale entry in /var/run/utmp
that has not been removed because your ssh session died uncleanly.

Reboot your server cleanly and the ghost utmp entry will disappear.

On Mon, Aug 06, 2012 at 01:00:15PM +0800, Alan Cheng wrote:
 Got nothing from  ps aux|fgrep acheng@ttyp4. No SSHD process to kill
 either.
 
 The problem for me is that no process belongs to ttyp4, but w still
 reports an idle session.
 
 FYI:
 $ ps aux|fgrep acheng@ttyp4
 
 $ w
  9:57PM  up 13 days,  1:31, 3 users, load averages: 0.16, 0.18, 0.23
 USERTTY FROM  LOGIN@  IDLE WHAT
 acheng   p0 180.116.63.38 6:00PM  1:50 -ksh
 acheng   p1 114.227.120.208:06PM 0 w
 acheng   p4 114.227.123.110  27Jul12 9days -
 
 $ ps aux | grep ksh
 acheng   13452  0.0  0.1   548   500 p0  Is 6:00PM0:00.02 -ksh (ksh)
 root 25705  0.0  0.1   632   528 p0  I+ 6:07PM0:00.07 -ksh (ksh)
 acheng   30721  0.0  0.1   480   488 p1  Ss 8:06PM0:00.02 -ksh (ksh)
 acheng   28924  0.0  0.0   480 4 p1  R+ 9:57PM0:00.00 -ksh (ksh)
 
 $ ps aux | grep sshd
 root 16212  0.0  0.2   656  1208 ??  Is23Jul120:04.01
 /usr/sbin/sshd
 root 30292  0.0  0.5  3456  2812 ??  Is 6:00PM0:00.07 sshd:
 acheng [priv] (sshd)
 acheng9594  0.0  0.7  4724  3612 ??  I  6:00PM0:02.20 sshd:
 acheng@ttyp0 (sshd)
 root 22538  0.0  0.5  3428  2828 ??  Is 8:06PM0:00.06 sshd:
 acheng [priv] (sshd)
 acheng   18141  0.0  0.6  3880  2920 ??  S  8:06PM0:02.19 sshd:
 acheng@ttyp1 (sshd)
 
 Thanks for the response.
 
 acheng
 
 On Mon, Aug 6, 2012 at 11:42 AM, David Diggles da...@elven.com.au wrote:
 
  On Mon, Aug 06, 2012 at 01:38:27PM +1000, David Diggles wrote:
   Try this?
  
   ps aux|fgrep acheng@ttyp3
 
 
  ps aux|fgrep acheng@ttyp4
 
  do you get the sshd process id you can kill?
 
 
   On Mon, Aug 06, 2012 at 10:56:00AM +0800, Alan Cheng wrote:
Hello all,
   
I'd like to kill an stale user session, but could not find a way to do
that. Seems like there is no process attached to that ttyp4 any more.
  It's
an OpenBSD 5.1 on i386, by the way.
   
Any advice appreciated.
   
some output, more will be provided if necessary.
   
#w
 7:44PM  up 12 days, 23:19, 2 users, load averages: 0.10, 0.14, 0.18
USERTTY FROM  LOGIN@  IDLE WHAT
acheng   p0 180.116.63.38 6:00PM 0 w
acheng   p4 114.227.123.110  27Jul12 9days -
 -- the one I'd like to kill
   
   
  
#ps -t p4
  PID TT  STAT   TIME COMMAND
   
   
thanks.
acheng



Re: kill a stale user session?

2012-08-05 Thread Alan Cheng
Ah ha, I searched marc.info earlier, but my key word did not found that
thread.
Now I know how it happened and how to fix it.

Thanks David.


On Mon, Aug 6, 2012 at 1:17 PM, David Diggles da...@elven.com.au wrote:

 http://marc.info/?l=openbsd-miscm=104862612011751w=2
 ---
 List:   openbsd-misc
 Subject:Re: Can't disconnect ghost SSH session from days ago
 From:   Mathieu Sauve-Frankel m.sauve () secureops ! com
 Date:   2003-03-25 20:59:44

 man utmp

 This ghost user is merely a stale entry in /var/run/utmp
 that has not been removed because your ssh session died uncleanly.

 Reboot your server cleanly and the ghost utmp entry will disappear.

 On Mon, Aug 06, 2012 at 01:00:15PM +0800, Alan Cheng wrote:
  Got nothing from  ps aux|fgrep acheng@ttyp4. No SSHD process to kill
  either.
 
  The problem for me is that no process belongs to ttyp4, but w still
  reports an idle session.
 
  FYI:
  $ ps aux|fgrep acheng@ttyp4
 
  $ w
   9:57PM  up 13 days,  1:31, 3 users, load averages: 0.16, 0.18, 0.23
  USERTTY FROM  LOGIN@  IDLE WHAT
  acheng   p0 180.116.63.38 6:00PM  1:50 -ksh
  acheng   p1 114.227.120.208:06PM 0 w
  acheng   p4 114.227.123.110  27Jul12 9days -
 
  $ ps aux | grep ksh
  acheng   13452  0.0  0.1   548   500 p0  Is 6:00PM0:00.02 -ksh
 (ksh)
  root 25705  0.0  0.1   632   528 p0  I+ 6:07PM0:00.07 -ksh
 (ksh)
  acheng   30721  0.0  0.1   480   488 p1  Ss 8:06PM0:00.02 -ksh
 (ksh)
  acheng   28924  0.0  0.0   480 4 p1  R+ 9:57PM0:00.00 -ksh
 (ksh)
 
  $ ps aux | grep sshd
  root 16212  0.0  0.2   656  1208 ??  Is23Jul120:04.01
  /usr/sbin/sshd
  root 30292  0.0  0.5  3456  2812 ??  Is 6:00PM0:00.07 sshd:
  acheng [priv] (sshd)
  acheng9594  0.0  0.7  4724  3612 ??  I  6:00PM0:02.20 sshd:
  acheng@ttyp0 (sshd)
  root 22538  0.0  0.5  3428  2828 ??  Is 8:06PM0:00.06 sshd:
  acheng [priv] (sshd)
  acheng   18141  0.0  0.6  3880  2920 ??  S  8:06PM0:02.19 sshd:
  acheng@ttyp1 (sshd)
 
  Thanks for the response.
 
  acheng
 
  On Mon, Aug 6, 2012 at 11:42 AM, David Diggles da...@elven.com.au
 wrote:
 
   On Mon, Aug 06, 2012 at 01:38:27PM +1000, David Diggles wrote:
Try this?
   
ps aux|fgrep acheng@ttyp3
  
  
   ps aux|fgrep acheng@ttyp4
  
   do you get the sshd process id you can kill?
  
  
On Mon, Aug 06, 2012 at 10:56:00AM +0800, Alan Cheng wrote:
 Hello all,

 I'd like to kill an stale user session, but could not find a way
 to do
 that. Seems like there is no process attached to that ttyp4 any
 more.
   It's
 an OpenBSD 5.1 on i386, by the way.

 Any advice appreciated.

 some output, more will be provided if necessary.

 #w
  7:44PM  up 12 days, 23:19, 2 users, load averages: 0.10, 0.14,
 0.18
 USERTTY FROM  LOGIN@  IDLE WHAT
 acheng   p0 180.116.63.38 6:00PM 0 w
 acheng   p4 114.227.123.110  27Jul12 9days -
  -- the one I'd like to kill


  
 
 #ps -t p4
   PID TT  STAT   TIME COMMAND


 thanks.
 acheng