Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <4161C5DF.ABAAEE64@dessent.net> Date: Mon, 04 Oct 2004 14:51:27 -0700 From: Brian Dessent Organization: My own little world... MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Help disconnecting SSH sessions References: <4161C240 DOT 6090903 AT overbored DOT net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com 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/