Killing ssshd seassions

stdout azi maillists.stdout at
Mon May 23 06:12:13 EST 2005


     First, I'd like to say sorry if this isn't the right mailing list
to ask my question. I'm writting some application(on Linux) wich relys
on sshd, so I thought there is nothing wrong in posting my mail here.

The aplication i'm writting should, at some point, kill the user from
his terminal line. To achieve this I read the users utmp entry and
kill the ut_pid in it.. It works fine if the user is not loged trought
ssh. If the user has a sshd seassion, killing the ut_pid doesnt work
though. I've done some workaround and got to this point  :

ps -aux

root   26621 0.0  0.3 5940 1644 ? S 21:33 0:00 sshd: janez [priv] <-
the pid in utmp
janez 2356 0.0  0.3 5940 1720 ? S 21:34 0:00 sshd: janez at pts/5 <- the
right one to kill

pstree -hupa

  |   `-sshd,26621
  |       `-sshd,2356,janez
  |           `-bash,10753

If killing the pid from utmp i get orphaned processes :

   |   `-bash,10753

More information about the openssh-unix-dev mailing list