Can someone tell me how to run this without a password prompt:
systemctl restart openvpn@myvpn.service`
in my sudoers file I have:
<myadminuser> ALL=NOPASSWD: /usr/bin/systemctl openvpn@myvpn.service restart,/etc/init.d/openvpn
and in ~/.bashrc I have:
alias or="systemctl restart openvpn@myvpn.service"
Solutions that I have tried:
If I add "sudo" in the alias, a password is requested inside the terminal. If I don't add sudo in the alias, box pops up, requesting a password. Hence, I posted the question here.
sudo. – muru Jan 04 '21 at 05:40sudo -lto see if some other rule is overriding it (e.g., https://unix.stackexchange.com/a/230318/70524) – muru Jan 04 '21 at 09:59sudoersrule issystemctl openvpn@myvpn.service restart, and you're runningsystemctl restart openvpn@myvpn.service. – muru Jan 04 '21 at 10:05restartin different places. – muru Jan 04 '21 at 10:09