I would like to save credentials when using OpenVPN in terminal. Is this possible?

I have using Gnome's network manager OpenVPN plugin and it is throwing errors with this particular VPN but using OpenVPN via the terminal works just fine except that should there be a disconnection, OpenVPN cannot automatically reconnect because it doesn't have the credentials. So is there a way to save them, perhaps through flag when running the command:

openvpn config.ovpn 

2 Answers

Add your username and password to a plain text file (eg login.file) and use the "auth-user-pass /path/to/login.file" directive to your config.ovpn file (or pass --auth-user-pass /path/to/login.file)

The format of login.file is simply

 username password 

I found a very simple undocumented way to save credentials directly inside .ovpn file.

instead of :

auth-user-pass credentials.txt 

insert :

<auth-user-pass> user password </auth-user-pass> 

also i got a "missing external certificate" error with NordVPN, fixed (MAYBE UNSAFE) by inserting the line below into the .ovpn file:

setenv CLIENT_CERT 0 

EDIT :

I was messing around to get rid of the NordVPN client :)

Here's my article if someone is interested :

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy