How to save your username and password in OpenVPN

Human Brain

For experienced VPN users using OpenVPN is a breeze, for those who are less technically minded just the action of installing and getting OpenVPN to work and then the addition of adding configuration files can seem like an achievement in itself.

One of the most annoying factors for most users is the requirement to continually  need to input your username and password every time you want to connect to a server. The requirement in itself is problematic and introduces two issues.

We can’t remember passwords!

Human BrainAs humans we have an inability to remember long combinations of random letters, numbers and symbols. We’re regularly told to keep passwords unique to every site that we visit and every service that we use, we’re also told not to use common words, names or details which are specific to ourselves.

Something like, “Z!e0uK7@bJc&” would be ideal, even better would be “.bcykyxy@Xl2Z!e0uK7@bJc&” but unfortunately unless you’re blessed with a unique talent, being able to easily remember such combinations is something the rest of us would find an impossible task.

As your internet usage grows the amount of services or websites that you sign up to increases, we may need to remember 5 random passwords, months later that could be 10… or 20… or 100! As I said, an impossible task. So the most obvious solution for many people is to use simple passwords such as, “password” or “123456” and if you don’t believe me the most common password in 2013 was “password” followed closely by “123456”. Requiring a password to be entered regularly leads to users choosing ones that are easy to remember making the choice insecure.

Better things to do than keep entering passwords

The second issue is it is rather tedious. Many users like to log in and out of their VPN for specific reasons. Users may log into do a bit of torrenting via the VPN, but then disconnect when logging in to their bank. Watching a bit of Sherlock if you’re outside the UK requires you to connect to your VPN, but if you need to make a quick Paypal transaction you might want to disconnect and so on.

Entering your username and password over and over can get repetitive and it is a requirement that most of us would gladly remove if possible. OpenVPN Username and Password windowThe great news is, it is possible to save both your username and password in your OpenVPN configuration and by following my simple steps you will never have to enter them again.

I must point out that saving passwords in plain text which is what is required goes against what is considered best practise for computer use, however if you’re one of the millions of users who use a simple password then this must be far superior in terms of security than your current password usage, the second reassurance is if you’re moving towards better practise for password use then your VPN password should be unique so in the extremely unlikely case that you ended up with a trojan on your system which in turn opened up a back door and let some nefarious type into your system, the only access they would gain would be to connect to your VPN.

In theory that would have been possible already even if you didn’t follow this process as it would have been possible for a criminal to install a key logger and log you typing it in each time. So in that regard it probably isn’t any less secure. So while this process wouldn’t be considered totally secure in computing terms, it will only really be bettered by you remembering your 25 character password in your head.

Step by step process

  1. Notepad Password ExampleNavigate to your OpenVPN installation folder, usually either C:\Program Files (x86)\OpenVPN\ or C:\Program Files\OpenVPN\
  2. In the Config folder create a new text file of any name you wish in Notepad or Wordpad.
  3. On the first line enter your username and on the second your password. (see image)
  4. Save this text file.
  5. Open the .ovpn config file that you want to save your password in with either Notepad or Wordpad.
  6. Add a new line to the bottom of the file and write : auth-user-pass password.txt (password.txt should be the name of your text file from Step 2)
  7. Save the file.

That is it! Next time you load up OpenVPN and connect to the profile of your choice you’ll no longer have to enter either your username or password.

If you have multiple servers that make use of the same username and password then you can paste in auth-user-pass password.txt on those config files too. Have a different profile that requires a different username and password? Just create a new text file with a different name and add the line in from Step 5.

Brain image courtesy of ddpavumba /

Author: Christopher Seward

Having used the internet since 1994, Christopher launched one of the very first VPN comparison websites in 2013. An expert in the field his reviews, testing and knowledge have helped thousands of users get the correct VPN for their needs.


  1. VPNCompare

    Have you entered the path of the text file containing your username and password?

    • shad0wf0x

      Oh it was sorted thanks, I think it was when I put the text in the same directory as the .ovpn the error was no more

      • VPNCompare

        Glad you got it sorted, sorry for the delayed reply but your question was hidden as spam 🙁 I have added you to a white list so that doesn’t happen again.

Leave a Reply

Your email address will not be published. Required fields are marked *