Gentoo Archives: gentoo-user

From: Dan Farrell <dan@×××××××××.cx>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] SSH won't restart
Date: Sun, 09 Sep 2007 02:20:08
Message-Id: 20070908210510.636c35c7@pascal.spore.ath.cx
In Reply to: Re: [gentoo-user] SSH won't restart by Alex Schuster
1 On Sat, 8 Sep 2007 22:50:20 +0200
2 Alex Schuster <wonko@×××××××××.org> wrote:
3
4 > Josh Cepek writes:
5 >
6 > > I had a similar issue after a previous update to ssh when I went to
7 > > restart it to get it to use the new binaries. One of the nice
8 > > features of sshd is that your current session will say active even
9 > > if you kill the sshd daemon process. Of course, if you get
10 > > disconnected then you will not be able to log back in, so it's good
11 > > to do what you need to quickly if you do need to kill (or if it's
12 > > really stuck, kill -9) the process. When I had this problem I
13 > > issued a `kill -9 PID_NUMBER && /etc/init.d/sshd start` - just be
14 > > *sure* that you're killing the /usr/sbin/sshd process and not one
15 > > of your sshd login forks at the same time.
16 > >
17 > > Alex Schuster wrote:
18 > > > If you think the upgrade is necessary and don't want to wait
19 > > > until you or s.o. else has physical access in case sshd doesn't
20 > > > come up again, you could
21 > > > try to restart sshd manually by issuing a "kill -SIGHUP $( pidof
22 > > > sshd )".
23 > >
24 > > I don't recommend doing this as it will also kill your current ssh
25 > > session. If for some reason the SIGHUP doesn't take correctly on
26 > > the listening daemon you will find yourself locked and kicked out
27 > > of the server. Use top or htop to determine the actual PID of the
28 > > daemon only.
29 >
30 > Oh, whoops! Big mistake, you are right - sorry for that, this was bad
31 > advice. I did not think about these other sshd processes. Thanks for
32 > being watchful and pointing this out.
33 > Still, I would prefer -HUP instead of -9, as this would make the sshd
34 > server restart itself. Just in case /etc/init.d/sshd start also makes
35 > trouble - it really shouldn't, but neither should /etc/init.d/sshd
36 > stop.
37 >
38 > Alex
39
40 Don't forget that you could potentially test out the new server on a
41 different port, and then if you can log in there you can
42 use that connection to kill the other sshd, and then you can restart
43 the normal sshd, and then kill the temporary sshd. I recommend this
44 method highly as it gives you another way to get in should something go
45 wrong. Just remember not to 'killall sshd'!
46 --
47 gentoo-user@g.o mailing list