How do I restart sshd on raspbian stretch?

This does not work:

pi@raspberrypi:~/.ssh $ sudo systemctl restart sshd
Failed to restart sshd.service: Unit sshd.service not found.
  • 4
    try this sudo systemctl restart ssh instead no d Feb 11, 2018 at 21:22
  • Why did they drop the d? Its sshd on my Debian stretch. Feb 11, 2018 at 21:51
  • 1
    On my Debian stretch I have ssh.service and sshd.service pointing both to /usr/sbin/sshd -D.
    – Ingo
    Feb 12, 2018 at 1:34
  • Can you please accept one answer, so your question is finished and will not pop up again for years?
    – Ingo
    Apr 10, 2020 at 10:03

3 Answers 3


Same issue with both stretch and jessie. Until you enable the service with:

systemctl enable ssh

you cannot refer to the service as "sshd". Once the service is enabled, no problem, you can even disable the service with:

systemctl disable sshd

Really stupid in my opinion but that's the way it is.

  • Exactly, I'm installing ArchlinuxArm to get rid of this kind of hassles.
    – wuxb
    Sep 30, 2019 at 18:04
  • @wuxb: You can run, but you cannot hide :) The ssh vs sshd thing is a deliberate decision by the folks who bring you systemd. LOL
    – Seamus
    Oct 11, 2023 at 20:04

In my case on raspberry pi 3B+ device with raspbian OS work this:

sudo service ssh status
sudo service ssh restart

As stated in the comments the main service is ssh.service. But you can it also address with sshd.service. As you can see ssh.service has an Alias:

pi ~$ systemctl cat ssh
# /lib/systemd/system/ssh.service
pi ~$

Quoted from man systemd.unit:

In addition, unit files may specify aliases through the Alias= directive in the [Install] section; those aliases are only effective when the unit is enabled.


pi ~$ sudo systemctl enable ssh

You can also get it with:

pi ~$ systemctl status sshd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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