Import OpenVPN Config From Command Line with Network Manager

By | 2017/01/14

Network Manager on Linux has a command line interface which can do everything and more than the gui version. Here is how to import an openvpn config from the command line!

In this example, the openvpn config is a single file from pfSense (Inline Configurations > Other, in pfSense speak) which works well for Linux users.

Import as follows, where the filename in this example is is: bach-udp-1194-khmiller-config.ovpn

$ sudo nmcli connection import type openvpn file bach-udp-1194-khmiller-config.ovpn
Connection 'bach-udp-1194-khmiller-config' (5b04c610-ca37-4f76-bb61-07e9acdc603a) successfully added.


nmcli does have tab completion, so when in doubt hit tab as options are typed to see what is possible.


$ sudo nmcli [TAB]
agent       connection  device      general     help        monitor     networking  radio       
$ sudo nmcli connection [TAB]
add      clone    delete   down     edit     export   help     import   load     modify   monitor  reload   show     up       
$ sudo nmcli connection edit [TAB]