This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help disconnecting SSH sessions


overbored wrote:
> 
> I would like to disconnect an SSH session. My sshd is set up as a
> Windows service (with the help of cygrunsrv). I am also currently logged
> in via SSH, so I'd like to kill another specific SSH session (I know
> where I'm logged in from). 'w' shows the two connections - my current
> one and the other one (to be killed). I just don't know how to proceed
> from here on out. ps doesn't list the processes, and using tasklist, I
> have no way of associating which sshd corresponds to which connection
> (and in fact it looks like there are three sshd's...I'm guessing the one
> with the lowest PID is the service, which spawns the other sshd's). Any
> hints? Thanks in advance.

sshd has one process that listens for connections and another process
for each active session.  Type "ps -al" and observe the PID and PPID
columns.  The listening sshd will have cygrunsrv's PID as its parent
process (PPID), and the "session" sshd's will have the "listening"
sshd's PID as their PPID.

The "--forest" ps option is great under linux, too bad it's not in
Cygwin ps.  :-)

If you have two sshd sessions then check the Windows Event Log
(equivalent of the syslog in *nix) for the sshd log messages.  Most of
the event is filler, but at the end will be something similar to "PID
7308 : Accepted publickey for brian from 127.0.0.1 port 2657 ssh2." 
This tells you that the sshd with PID 7308 corresponds to that login
from that IP.  If using the event log is cumbersome, then you can
configure sshd to log to a regular file instead, possibly in conjunction
with the cygrunsrv options for redirecting stdout and stderr.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]