Automating Restart of SSSD Service on Ubuntu

Recently, I found myself in a situation where the SSSD service on my Ubuntu server crashed. This was kind of an issue because it meant that all authentication requests were denied. It took a call from an upset dev to figure out what the problem was and then I needed to login and manually restart the service. To prevent this from happening again, I decided to automate the process with a systemd unit file.

Steps to Automate restart of SSSD service on Ubuntu:

Create a new file:

/etc/systemd/system/multi-user.target.wants/sssd.service

Add the following to the file:

[Unit]
Description=System Security Services Daemon
# SSSD must be running before we permit user sessions
Before=systemd-user-sessions.service nss-user-lookup.target autofs.service
Wants=nss-user-lookup.target

[Service]
ExecStart=/usr/sbin/sssd -i -f
Type=notify
NotifyAccess=main
PIDFile=/var/run/sssd.pid
Restart=always
RestartSec=120

[Install]
WantedBy=multi-user.target

sudo systemctl | grep -i "sssd*"

Save and close the file. Reload your systemd daemon to apply this new configuration: sudo systemctl daemon-reload

sudo systemctl start sssd.service

That's it your are done. Happy automating.

🚀 **Support Our DevOps Blog with Your Amazon Shopping!** 🚀 Love shopping on Amazon? Now you can fuel your shopping spree *and* support our blog at no extra cost! Just use our link for your next purchase: **[Shop on Amazon & Support Us!] Browse Stuff on Amazon Every click helps us keep sharing the DevOps love. Happy shopping!

Leave a Comment