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.

πŸš€ Join the DevOps Dojo! 🌟

Are you passionate about growth, learning, and collaboration in the world of DevOps? The DevOps Dojo is your new home! Whether you’re just starting out or looking to refine your skills, this vibrant community is here to support your journey.

πŸ”§ What You’ll Get:

  • Access to expert-led discussions
  • Hands-on learning opportunities
  • Networking with like-minded professionals

Ready to take your DevOps game to the next level? Click below to learn more and join the community!

πŸ‘‰ Join the DevOps Dojo Today

Let’s build, grow, and thrive together! 🌐

Leave a Comment