terminate ghosting users?

tag

macrumors 6502a
Original poster
Apr 29, 2005
918
9
I use terminal quite often, and every now and then I close a terminal session by using command+Q before I type exit to log out. This sometimes causes a problem of leaving my account logged in again via terminal, with no way of logging out that terminal session.

Example of what I have right now...

iMac:~:$> finger tag
Login: tag Name:
Directory: /Users/tag Shell: /bin/bash
On since Fri Jul 29 18:07 (EDT) on console, idle 9 days 8:32 (messages off)
On since Mon Aug 8 02:32 (EDT) on ttyp1
On since Thu Aug 4 21:29 (EDT) on ttyp3, idle 3 days 5:11
On since Thu Aug 4 21:39 (EDT) on ttyp4, idle 3 days 5:21
Last login Mon Aug 8 02:39 (EDT) on ttyp2
No Mail.
No Plan.

I can't access or log out of the sessions running on ttyp3 and ttyp4.

Now on my netBSD server if this happens I can easily run 'ps' to find and kill the shell tied to each of those logged on instances, but on my Mac, they don't show up for some reason. Does anyone know of a way to terminate all those active logins which I can't access?
 

superbovine

macrumors 68030
Nov 7, 2003
2,872
0
tag said:
I use terminal quite often, and every now and then I close a terminal session by using command+Q before I type exit to log out. This sometimes causes a problem of leaving my account logged in again via terminal, with no way of logging out that terminal session.

Example of what I have right now...

iMac:~:$> finger tag
Login: tag Name:
Directory: /Users/tag Shell: /bin/bash
On since Fri Jul 29 18:07 (EDT) on console, idle 9 days 8:32 (messages off)
On since Mon Aug 8 02:32 (EDT) on ttyp1
On since Thu Aug 4 21:29 (EDT) on ttyp3, idle 3 days 5:11
On since Thu Aug 4 21:39 (EDT) on ttyp4, idle 3 days 5:21
Last login Mon Aug 8 02:39 (EDT) on ttyp2
No Mail.
No Plan.

I can't access or log out of the sessions running on ttyp3 and ttyp4.

Now on my netBSD server if this happens I can easily run 'ps' to find and kill the shell tied to each of those logged on instances, but on my Mac, they don't show up for some reason. Does anyone know of a way to terminate all those active logins which I can't access?
mine does:

Code:
superbovine:cow ~ $ who
cow      console  Aug  8 11:52 
cow      ttyp1    Aug  8 11:52 
cow      ttyp2    Aug  8 12:03 
superbovine:cow ~ $ ps -a
  PID  TT  STAT      TIME COMMAND
  197  p1  Ss     0:00.04 login -pf cow
  202  p1  S      0:00.03 -bash
  205  p1  RN+    9:04.32 /Users/cow/dnetc494-macosx-ppc/dnetc
  230  p2  Ss     0:00.02 login -pf cow
  231  p2  S      0:00.03 -bash
  234  p2  R+     0:00.01 ps -a
superbovine:cow ~ $
 

tag

macrumors 6502a
Original poster
Apr 29, 2005
918
9
But do you have actual physical access to both of those users terminal sessions logged in on ttyp1 and ttyp2 (as in you can issue commands to the terminal via them?)

Code:
iMac:~:$> who
tag      console  Jul 29 18:07 
tag      ttyp1    Aug  8 14:06 
tag      ttyp3    Aug  4 21:29
tag      ttyp4    Aug  4 21:39

iMac:~:$> ps -a
  PID  TT  STAT   TIME    COMMAND
10353  p1  Ss     0:00.03 login -pf tag
10354  p1  S      0:00.03 -bash
10357  p1  R+     0:00.01 ps -a
10228 cu.  Ss+    0:00.48 pppd
   34  ??  S+     0:00.99 /usr/libexec/ipfwloggerd
I can even check to see what processes are being run in those tty's but they don't show anything, so I'm not sure how those user instances are even staying connected to the tty.

Code:
iMac:~:$> ps -a -t p3
PID    TT    STAT    TIME    COMMAND
iMac:~:$>
 

tag

macrumors 6502a
Original poster
Apr 29, 2005
918
9
superbovine said:
hmmm... damn that sucks.

what about?:

Code:
sudo ps -A

Tried that still a no go. I've used 'ps' with every possible combination of options available with no success. I really can't get my head around how these ghost user instances are staying logged in without any processes running at all. This happens quite often so its really getting annoying, it doesn't bother me enough to reset to terminate them since this usually happens again after the reboot, but it is a curious matter.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.