Start/Stop VPN connections CLI in Ubuntu

To list all network manager connections and get the uuid for the connection

nmcli con

To start a connection

nmcli con up uuid <uuid number>

To stop

nmcli con down uuid <uuid number>

Example:

sudo nmcli con up uuid 7e098422-70ac-40ce-b504-ee7c5427482c

If the user doesn’t have the permissions to stop and start the connections then you will have to sudo the commands.

VPN connections normally¬†fail with “Error: Connection activation failed: no valid VPN secrets”

To resolve edit /etc/NetworkManager/system-connections/ConnectionName

Set

password-flags=0

And add the following lines

[vpn-secrets]
password=YourPassword
Posted in Linux