Add to Favourites    Print this Article

How to use OpenVPN from Command Line on Ubuntu/Debian/Mint

Setting up an OpenVPN client for Ubuntu/Debian/Mint, CLI edition.

1) Install the OpenVPN package:

sudo apt install openvpn

2) Now change to the OpenVPN directly and download the config files:

cd /etc/openvpn

sudo wget

3) Unzip the downloaded config files:

sudo unzip

4) Move all files to /etc/openvpn/

sudo cp /etc/openvpn/OpenVPN-TCP/* /etc/openvpn/

5) Re-name the .ovpn config files to .conf, Example: server.ovpn to server.conf, run the bellow command to rename them all to .conf.

rename -v 's/\.ovpn/\.conf/' *.ovpn

6) Run your configs like so:

openvpn server.conf

7) If you would like to save your user/pass to prevent you from entering a user/pass each time you run a config please see this guide here

For stopping and starting the OpenVPN service, use the commands below:

sudo service openvpn start or stop or restart

Also Read