up vote 0 down vote favorite
share [g+] share [fb]

Title says it all. but here is the scenario:

1) Connected to work via VPN 2) on a Linux client 3) ssh root@server.company.com 4) #init 1 5) ????

???? Will going down to "single user mode" via "init 1" kill and disconnect my root ssh session?

link|improve this question
feedback

3 Answers

up vote 2 down vote accepted

Yes, yes it will. Most services don't run in runlevel 1.

link|improve this answer
feedback

It should be OK. Whilst the SSH listener daemon is stopped in runlevel 1 on most distros, existing connections should stay up, and networking shouldn't be affected. I wouldn't be doing it without having some sort of remote console connected, though -- you never know when a rogue solar flare is going to come along and drop your network connections for juuuuust long enough to kill your SSH session.

EDIT: Some testing indicates that, on Debian systems at least, /etc/rc1.d/S30killprocs will take down existing SSH connections (because it's killing off everything). I would be inclined to knobble that script temporarily and do it's job by hand (avoiding the SSH connections) if I were to try to do what you want to do. I'd still prefer to use a remote console, though.

link|improve this answer
I'm under the impression that S30killprocs only kills "user processes".. and NOT deamon services???.. – Heston Holtmann Dec 22 '09 at 5:50
I can confirm that /etc/rc1.d/K??sshd -> /etc/init.d/sshd.sh existed on this particular and would KILL my remote ssh session if i did a "init 1". – Heston Holtmann Dec 22 '09 at 5:52
An existing SSH connection would likely count as a "user process", not a "service daemon", but my killprocs has no logic in it to distinguish between the two anyway. As far as your second comment goes, as I wrote in my answer, "Whilst the SSH listener daemon is stopped [...] existing connections should stay up". You can test this by running /etc/init.d/ssh stop from SSH, and noting that your SSH session does not drop. This is by design, as otherwise remote upgrades would be an overly exciting experience. – womble Dec 22 '09 at 6:52
feedback

"/etc/init.d/ssh stop" stopped ssh without killing my existing ssh session, but "init 1" did...

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.