This question has been updated. Please see the tail end of this post.
I am trying to set up my Mythbuntu computer to connect to a VPN service when it starts up. My hope is that the Mythbuntu computer will always use the VPN for all of its internet connections.
I found a script that will supposedly do that, and it looks like this:
#!/bin/bash while [ "true" ] do VPNCON=$(nmcli con status) if [[ $VPNCON != "*MyVPNConnectionName*" ]]; then echo "Disconnected, trying to reconnect..." (sleep 1s && nmcli con up uuid df648abc-d8f7-4ce4-bdd6-3e12cdf0f494) else echo "Already connected !" fi sleep 30 done
When I run this script on my machine, I get the following error:
$ /home/mythbuntu/VPN_start.sh Disconnected, trying to reconnect... Error: Connection activation failed: Not authorized to control networking.
I thought it might be a permission issue, so I tried running it with sudo:
$ sudo /home/mythbuntu/VPN_start.sh [sudo] password for mythbuntu: Disconnected, trying to reconnect... Active connection state: unknown Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1 state: VPN connecting (need authentication) (2) Error: Connection activation failed: no valid VPN secrets.
How do I get this script to run without errors so that I can run it at boot or login so that I can make sure I'm always connecting by VPN.
If anyone has a better script or method, that would also suffice as an answer.
These are the contents of my /etc/NetworkManager/system-connections/MyVPN file (some details replaced with x characters for privacy):
[connection] id=MyVPN uuid=xxxxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxxxxx type=vpn [vpn] service-type=org.xxxxxxxxxxxxxx.xxxxxxxxxxxxxxx.openvpn username=xxxxxxxxxx comp-lzo=yes remote=us-xxxxxx.xxxxxxx.com connection-type=password password-flags=0 ca=/etc/openvpn/xxxxxxx.crt [vpn-secrets] password=xxxxxxxxxxx [ipv4] method=auto never-default=true
Also, I just want to add that when I turn on the VPN using the applet in top right corner the Xfce panel, it connects no problem. So the issue doesn't seem to me to be one of incorrect authorization, but of the configuration when trying to do this from the command line.
I'm not entirely sure what has changed - possibly something in the upgrade to 12.10 - but I can now start my VPN service from the command line. However, this command only works once when I very first start the computer, and also it needs to be run with
mythbuntu@mythbuntu:~$ nmcli con up id "Private Internet Access SSL" Error: Connection activation failed: Not authorized to control networking. mythbuntu@mythbuntu:~$ sudo nmcli con up id "Private Internet Access SSL" [sudo] password for mythbuntu: mythbuntu@mythbuntu:~$
Since I need to use
sudo to run this, I can't run it automatically at startup.
How do I get it so that I can start my VPN without super user permissions?