/etc/init.d/ssh restart does not reload the configuration

8,019

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.

Share:
8,019

Related videos on Youtube

Raphael K
Author by

Raphael K

Updated on September 18, 2022

Comments

  • Raphael K
    Raphael K almost 2 years

    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.
    • alphamikevictor
      alphamikevictor about 9 years
      Do you have the same behaviour if you make stop and then start.
  • wurtel
    wurtel about 9 years
    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.
  • Raphael K
    Raphael K about 9 years
    Thanks for the advice about killing the daemon! I will try it out.
  • kasperd
    kasperd about 8 years
    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.