How to add a new OpenVPN user

In this post we will show you how to create new users for your OpenVPN instance.

For this operation to be possible you will need to have root access to your server. If you don't know how to gain that, please follow our guide.

After logging in the ssh console you can run the following command in order to create new users:

docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm -it kylemanna/openvpn easyrsa build-client-full CLIENTNAME nopass

Replace CLIENTNAME with a username.

This will generate the files for the new user and place them in the right directory. The command will also prompt for your password (it's the one that was emailed to you when we sent you the first config).

With the new user created we need to retrieve the config so here's a new command you need to run:

docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm kylemanna/openvpn ovpn_getclient CLIENTNAME > CLIENTNAME.ovpn

The above command printed the entire config and piped it into a file called CLIENTNAME.ovpn which is now sitting in your home folder. To view and copy the contents you can run cat CLIENTNAME.ovpn. That's it!

In all these commands you need to replace CLIENTNAME with the username.