2025-02-09
Passwordless restart of systemd services
Before anything else, you need to edit the rights, do this as your sudo/admin user:
$ sudo EDITOR=vim visudoAdapt the line to your needs, first is the user, you want to give the passwordless permission to restart the service, last entry of the line is the name of the service.
# allow deployuser to restart the web services without needing a password
deployuser ALL=(ALL) NOPASSWD: /bin/systemctl restart myapponsystemd-worker.service
deployuser ALL=(ALL) NOPASSWD: /bin/systemctl restart myapponsystemd.serviceThen log into your VPS/Server as your deployuser and restart your app 🚀
$ sudo systemctl restart myapponsystemd.serviceSource on YouTube @Dreams of Code
← Previous Post | Next Post →