Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 429  / 3 Years ago, wed, september 22, 2021, 8:13:46

Using the integrated Network Manager, I created a new VPN Connection, called 'My VPN'. When I click it, it connects - great.



Now I need to automate it a bit. Is it possible to write a script which will connect to that specific connection by name, or whatever? Once it's connected, I want to start up my browser...



Using Ubuntu 14 x64


More From » networking

 Answers
5

First add the credentials in the connection configuration file, look for a file in /etc/NetworkManager/system-connections called "MyVPN" and add the following section:



[vpn-secrets]
password=my_vpn_password


Then add password-flags=0 and secret-flags=0 into the [vpn] section.



Now you can easily create a connection to your new VPN with nmcli:



nmcli con up id 'My VPN'


Note that you may need to open the VPN configuration from the NetworkManager applet and save it from there to allow command-line connections.


[#22615] Thursday, September 23, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aveerakfas

Total Points: 106
Total Questions: 148
Total Answers: 129

Location: Monaco
Member since Sun, Jan 1, 2023
1 Year ago
;