1

Question:

I need to auto-start a GUI application that requires sudo.

I know I need to edit the sudoers file with:

sudo visudo

However, I don't know what to write in the file.

What I already tried:

sudo visudo

and then added the following:

nanostuff ALL = NOPASSWD: /usr/lib/AirVPN/AirVPN.exe

I also tried with:

nanostuff ALL = NOPASSWD /usr/bin/X11/airvpn

and

nanostuff ALL = NOPASSWD /usr/bin/airvpn

None of those worked.

By doing:

ps aux | grep airvpn

I get the following output:

nanostuff    6805  0.2  0.4 483520 17384 ?        Sl   17:13   0:01 /usr/bin/gksu -u root -m AirVPN Client needs administrative privileges. Please enter your password. mono /usr/lib/AirVPN/AirVPN.exe path=/home/nanostuff/.airvpn
root      6806  0.0  0.0  78604  2392 ?        Ss   17:13   0:00 /usr/bin/sudo -H -S -p GNOME_SUDO_PASS -u root -- mono /usr/lib/AirVPN/AirVPN.exe path=/home/nanostuff/.airvpn
root      6808  3.2  2.0 1257532 83032 ?       Sl   17:13   0:12 mono /usr/lib/AirVPN/AirVPN.exe path=/home/nanostuff/.airvpn
root      6832  0.0  0.0  22652  3336 ?        S    17:14   0:00 /usr/sbin/openvpn --config /home/nanostuff/.airvpn/384ef91f85df5ea2abc88c7416b95bbdf2bc4299edd2850614d4e343ba721ae3.tmp.ovpn
nanostuff    6951  0.0  0.0  18932   932 pts/2    S+   17:20   0:00 grep --color=auto airvpn

I've added sudo usr/bin/airvpn as well as gksu usr/bin/airvpn to the auto-startup and nothing...

Additional info:

  • OS: Ubuntu 14.04 64bits
  • Application: It's a VPN client
2
  • It's only been 4 hours since you posted this; you may well still get an answer. How do I launch a GUI application as root on user login? might have been a somewhat better question for me to suggest than Allow “root” program to run without privileges. How are you trying to autostart it? In particular, what command is being run on startup? (The main thing people forget is, that command must still begin with sudo.) Do you know which of the three executables is the one that's supposed to be run? Aug 21, 2014 at 16:15
  • If there's any information I should not be showing in the code I edited (for security reasons), please let me know..
    – user319055
    Aug 21, 2014 at 16:23

2 Answers 2

1

This is not actually my answer. This answer was given by a user (@steeldriver) in this post.

I added the following to the start-up applications:

sudo -H -u root -- /usr/bin/mono /usr/lib/AirVPN/AirVPN.exe path=/home/nanostuff/.airvpn

and:

nanostuff    ALL=(ALL) NOPASSWD: /usr/bin/mono /usr/lib/AirVPN/AirVPN.exe path=/home/nanostuff/.airvpn

to the sudoers file, using sudo visudo.

After all that, it works! Thank you steeldriver and ubuntuforums!

0

I would post this as a comment but as I do not have enough reputation to post comments yet I'll post this as an answer instead.

Is there any particular reason why you are using their VPN client rather than say the network manager built into Ubuntu?

A quick look in the AirVPN forums found this guide which should show you how to configure the AirVPN service on Ubuntu using the Ubuntu Network Manager.

https://airvpn.org/topic/11432-using-airvpn-with-ubuntu-network-manager/

In order to protect against link rot here's the post (minus the screenshots):

Go to Config Generator page, choose Linux and choose your preferred options. Select Advanced Mode Tick Separate certs/keys from .ovpn files

Click on any archive format. Save the downloaded archive file somewhere, say in ~/.airvpn. Extract it. Five files should be extracted. Try to make sure nobody but you can read the file user.key, because that one is secret. Install the package named network-manager-openvpn-gnome, which is a plugin to NetworkManager handling OpenVPN connections. The install will automatically include all needed packages, like openvpn etc.

Click on NetworkManager icon in top-right bar, and choose Edit Connections...

Click Add, choose Import a saved VPN configuration, click Create... and choose a .ovpn file extracted from files generated by our Config Generator.

The imported information is displayed. Click Save... and close the NetworkManager Connections editor.

From now on, the imported connections are showed under VPN Connections menu. Click it to connect.

0

You must log in to answer this question.