Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I use sudo command from terminal in the default Ubuntu 12.04 guest account, in order to connect to vpn client and service. (OpenVPN+TrustConnect+Comodo)

I know it has been disable by default(sudo), but I want to use guest account, apparmor, etc, and security feutures of guest account, and still be able to connect to vpn.

Vpn client and service wont star without sudo command.

share|improve this question
Is configuring network-manager to connect to the VPN at boot an option? – Jordan Uggla Aug 13 '12 at 22:09
@Jordan Uggla Wow, is the first time I hear about that, I will study that one and give it a try. Thanks – Alex Aug 13 '12 at 22:50

Add a rule to the sudoers file that gives the guest account the permission to gain root privileges but only execute the command that starts the VPN, and possibly the command that stops the VPN.

Run visudo, and add lines like the following:

guest ALL = /usr/sbin/service openvpn start
guest ALL = /usr/sbin/service openvpn stop

Alternatively, if applicable, you could tie the VPN service to the network interface for general Internet connectivity. For example, if your network interface is eth0, add a file in /etc/network/if-up.d/ containing

if [ "$IFACE" = "eth0" ]; then
  service openvpn start

and in /etc/network/if-down.d/ containing

if [ "$IFACE" = "eth0" ]; then
  service openvpn stop

If you use OpenVPN and your network interface is configured in /etc/network/interfaces rather than via NetworkManager, you can configure an OpenVPN VPN to start there.

iface eth0 inet dhcp

There may be a way to do this with NM as well but I don't know how.

share|improve this answer

You could use sudo and the usermod command from an account that does have sudo access to add the adm group (for 12.04) to the account. Don't forget to use the -a option to add the group rather than replacing the group list.

share|improve this answer
Hmm, guest accounts on Ubuntu are created and destroyed on the fly... Each login a different one. Doable changing the template, but not so straightforward.... – Rmano May 2 '14 at 5:38
That would give the guest account admin powers, which defeats the purpose of a guest account. – Gilles Jun 7 '14 at 22:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.