Use Wireguard Without a Password on Ubuntu 20.04

Viewed 757

Now that I finally got my wireguard vpn working. I'm wondering if someone could help write the sudoers command that will allow me to connect and disconnect without a password.

In my /etc/sudoers file I currently have:

#includedir /etc/sudoers.d
username ALL=NOPASSWD: /usr/bin/wg

Which works great for:
$wg

But how do I edit the sudoers in order to be able to execute these without a password:
$wg-quick up wg-client1 and $wg-quick down wg-client1

thanks

1 Answers

Add the path to the wg-quick executable to your existing wg sudoers rule:

username ALL=NOPASSWD: /usr/bin/wg, /usr/bin/wg-quick
Related