You are not logged in.
Hello, I need to manage VM from script, so I added this rows in visudo
andrew ALL = NOPASSWD: /usr/bin/virsh start win11
andrew ALL = NOPASSWD: /usr/bin/virsh list --all
sudo -lU andrew:
User andrew may run the following commands on archlinux:
(root) NOPASSWD: /usr/bin/virsh start win11
(root) NOPASSWD: /usr/bin/virsh list --all
(ALL) ALL
BUT, when I run this from bash
sudo virsh start win11
sudo virsh list --all
It requests the password.
What am I doing wrong?
Last edited by AndreyFrantsevich (2024-04-16 13:52:59)
Offline
Have you logged back in before attempting those commands?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
You have to enter exactly the same command as defined in /etc/sudoers:
Your user is only allowed to use:
/usr/bin/virsh
with options: start win11 and list --all
It's not allowed to use "virsh" without the full path prefix.
This is a security feature when using sudo.
Offline
Have you logged back in before attempting those commands?
who:
andrew tty7 2024-04-16 16:39 (:0)
andrew pts/4 2024-04-16 17:22
andrew pts/3 2024-04-16 17:19
Offline