Sudo permission with no password

ale_fedeli

Cadet
Joined
Apr 19, 2022
Messages
2
Hi, I'm trying to create a user with sudo permission for a few commands (reboot and shutdown) but with no password required, so that my Raspberry Pi (that's running Home Assistant) can remotely shut down my Nas when my Ups battery ( which powers both devices) is low. I've tried to modify the Sudoers file, but when I reboot the machine, all the changes that I've made get lost.

Can someone help me?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Create the user in the GUI and add it to the wheel group.

You could also set up NUT on your Pi and have the NAS UPS service connect to that and manage it from there instead.
 
Joined
Jun 2, 2019
Messages
591
@ale_fedeli

If you have your UPS connected to your RPi via USB, you can install NUT and set it up as a UPS Master.
Then set up your NAS as a UPS Slave (any another clients for that matter), which will monitor the UPS status and shutdown by itself.

Works automagically!
 
Top