Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Killing ssshd seassions

0 views
Skip to first unread message

stdout azi

unread,
May 22, 2005, 4:40:17 PM5/22/05
to
Hello,

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@pts/5 <- the
right one to kill

pstree -hupa

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


If killing the pid from utmp i get orphaned processes :

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

_______________________________________________
openssh-unix-dev mailing list
openssh-...@mindrot.org
http://www.mindrot.org/mailman/listinfo/openssh-unix-dev

Peter Stuge

unread,
May 22, 2005, 10:30:21 PM5/22/05
to
On Sun, May 22, 2005 at 08:12:13PM +0000, stdout azi wrote:
> 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@pts/5 <- the
> right one to kill

You could go through the process table and kill the process that has
it's PPID==ut_pid.


//Peter

Darren Tucker

unread,
May 22, 2005, 10:42:22 PM5/22/05
to
stdout azi wrote:
> 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.

This is the right place.

> 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 :

What version of OpenSSH is this? There was a change between 3.6.1 and
3.7 that caused the monitor to kill the non-priviliged child the monitor
was terminated. It will pass through SIGTERM and SIGHUP.

--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

0 new messages