Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

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

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

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

share|improve this answer
add comment

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.

share|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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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