I've added a chroot configuration to my /etc/ssh/sshd_config.

I reload the configuration file using /etc/init.d/ssh reload, then try to connect using an SFTP client, but nothing changes, the user is able to log in but is not chrooted.

However, if I manually start an SSH daemon (on a different port) with /usr/sbin/sshd -p2222, the new configuration gets loaded and the chroot applies.

Any hint why /etc/init.d/ssh reload would not actually reload the configuration ?

Additional info:

  • Same issue happens if I use restart instead
  • While reloading/restarting, I have an open connection to the server for my root access
  • I'm running Debian Wheezy.
  • Do you have the same behaviour if you make stop and then start. – alphamikevictor Apr 29 '15 at 9:33

Instead of running /etc/init.d/ssh restart use service ssh restart.

On Ubuntu 14.04.2 the config changes will not occur when calling the init script directly. It's quite likely that Debian is the same here.

  • This answer sounded implausible to me, so I tested it on an Ubuntu 14.04.4 system. And it turns out this is indeed correct in the case of Ubuntu. I don't have a Debian system suitable for testing this. – kasperd Apr 23 '16 at 11:38

Turns out that neither restart or even stop+start was sufficient as it wouldn't kill the running daemon of sshd.

I had to grab a physical access to the server, stop, then kill <sshd PID> (so that the server wouldn't accept any new incoming connection), and then start again the daemon.

  • 5
    You could have done this remotely, killing the listening daemon doesn't touch running ssh sessions. That said, it sounds like you changed the pid file location in addition to other config changes, as I've never experienced having the ssh daemon not restarting. – wurtel Apr 29 '15 at 12:07
  • Thanks for the advice about killing the daemon! I will try it out. – Raphael K Apr 29 '15 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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