Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
1  
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 comment

2 Answers 2

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

#!/bin/sh
if [ "$IFACE" = "eth0" ]; then
  service openvpn start
fi

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

#!/bin/sh
if [ "$IFACE" = "eth0" ]; then
  service openvpn stop
fi

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
    OPENVPN=trustconnect

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

share|improve this answer
add comment

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 at 5:38
    
That would give the guest account admin powers, which defeats the purpose of a guest account. –  Gilles Jun 7 at 22:26
add comment

Your Answer

 
discard

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.