Page 1 of 1

special sudo permission for user homeassistant

Posted: Sun Nov 22, 2020 6:44 pm
by mail2rst
is anybody help me about how to give some special power to any user? I have running homeassistant on dietpi. in default installation of dietpi-software the homeassistant run under homeassistant username. i want to make some automation in homeassistant GUI to put switch on/off to switch for samba share. to perform this task I have to give the the stop & start privilege to homeassistant user. please help me how i can achieve this. from my internet search i found that i have to add these two lines in "/etc/sudoers" under "root ALL=(ALL:ALL) ALL"
"
root ALL=(ALL:ALL) ALL

homeassistant ALL=(ALL) NOPASSWD: /bin/systemctl stop smbd
homeassistant ALL=(ALL) NOPASSWD: /bin/systemctl start smbd
"
but this is critical thing for whole system. so i want the expert can guide me step by step how this thing achieve. also this file not having direct access. we have to access through it "sudo visudo" but when i add these lines & save the file. its store like "/etc/sudoers.tmp" . even after reboot these privileges not given to homeassistant. so the end question here is how to check the consistency of new file & swap it to active file then *.tmp file. thanks in advance.

Re: special sudo permission for user homeassistant

Posted: Tue Nov 24, 2020 5:13 pm
by mail2rst
i am able to get my required result by adopting the above mentioned procedure & system works accordingly,
thanks