How to fix Failed to restart samba.service: Unit samba.service not found on Debian & Ubuntu

Problem:

When trying to restart the Samba service on Ubuntu or Debian using

example.sh
sudo systemctl restart samba

you see this error message:

example.txt
Failed to restart samba.service: Unit samba.service not found.

Solution

The samba service is called smbd, not samba. Restart it using

example.sh
sudo systemctl restart smbd

Check out similar posts by category: Linux