Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing pkexec with sudo #8

Open
k561 opened this issue Jan 9, 2023 · 3 comments
Open

Replacing pkexec with sudo #8

k561 opened this issue Jan 9, 2023 · 3 comments

Comments

@k561
Copy link

k561 commented Jan 9, 2023

If you get tired of entering the password requested by pkexec, you can use sudo.
Add in /etc/sudoers:
user ALL=NOPASSWD:/usr/bin/wg-quick

and replace in ~/.local/share/cinnamon/applets/wireguard@nicoulaj.net/applet.js:

$diff applet.js.bak applet.js 
124c123
<                 ['pkexec', 'wg-quick', enable ? 'up' : 'down', iface],
---
>                 ['sudo', 'wg-quick', enable ? 'up' : 'down', iface],
@pzim-devdata
Copy link

pzim-devdata commented Jan 22, 2023

For not entering the password every times you want to connect or disconnect, as @k561 said, replace in ~/.local/share/cinnamon/applets/wireguard@nicoulaj.net/applet.js pkexec by sudo line 123 :
Replace :

['pkexec', 'wg-quick', enable ? 'up' : 'down', iface],

by :

['sudo', 'wg-quick', enable ? 'up' : 'down', iface],

Then in sudo visudo add this line : with no empty line :

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
YOUR_USER_NAME ALL=(ALL) NOPASSWD: /usr/bin/wg-quick
# See sudoers(5) for more information on "@include" directives:

Replace YOUR_USER_NAME by your username or ALL

########################

The config files needs to be in /etc/wireguard/ (e.g /etc/wireguard/wg0.conf)
And you must let reading access for your username to the folder wiregard : sudo chmod o+r /etc/wireguard

########################

Finally restart Cinnamon to make it works ( Alt+F2, type r and hit enter)

@coaperator
Copy link

For not entering the password every times you want to connect or disconnect, as @k561 said, replace in ~/.local/share/cinnamon/applets/wireguard@nicoulaj.net/applet.js pkexec by sudo line 123 : Replace :

['pkexec', 'wg-quick', enable ? 'up' : 'down', iface],

by :

['sudo', 'wg-quick', enable ? 'up' : 'down', iface],

Then in sudo visudo add this line : with no empty line :

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
YOUR_USER_NAME ALL=(ALL) NOPASSWD: /usr/bin/wg-quick
# See sudoers(5) for more information on "@include" directives:

Replace YOUR_USER_NAME by your username or ALL

########################

The config files needs to be in /etc/wireguard/ (e.g /etc/wireguard/wg0.conf) And you must let reading access for your username to the folder wiregard : sudo chmod o+r /etc/wireguard

########################

Finally restart Cinnamon to make it works ( Alt+F2, type r and hit enter)

image

How to fix it?

@pzim-devdata
Copy link

Sorry I don't know, I don't use WIregard anymore. Create a new issue and explain what you have done...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants