Knowledgebase: OpenVPN Setup
How to auto connect without typing the User/Pass? Connect on startup?
Posted by Max Biggavelli on 23 October 2011 14:04

1. On your Desktop create a new text file, and name it "myauth.txt" or something similar. Then enter your username and password on one line each, like so:


Once finished, move your myauth.txt file, into the OpenVPN "config" directory. (Usually "C:\Program Files\OpenVPN\config" and C:\Program Files (x86)\OpenVPN\config on 64bit)

2. Open and edit your .ovpn file with a text editor. Change the "auth-user-pass" line to: "auth-user-pass myauth.txt"  (without quotes)

3. Important: This is not supported by all OpenVPN Versions, you need a version newer than Version 2.2 and above.


4. Go to the bin directory for OpenVPN (OpenVPN\bin) and make a shortcut for the OpenVPN-GUI exe. (The shortcut may be placed on the Desktop, this doesn't matter, we're going to move it anyway).

Right click the shortcut and choose properties. In the "Target:" box, it should read something like:

"C:\Program Files (x86)\OpenVPN\bin\openvpn-gui-1.0.3.exe" (with quotes).

Add onto the end (outside of the quotes) --connect username.ovpn where username is your username. Now it should look like:

"C:\Program Files (x86)\OpenVPN\bin\openvpn-gui-1.0.3.exe" --connect username.ovpn

Move this shortcut to the Startup folder, which is located in All Programs. If you can't find it, go to %appdata%\Microsoft\Windows\Start Menu\Programs\Startup.


From now on your User/Pass will be taken from the textfile. If you change the User/Pass in Members Area, dont forget to update the myauth.txt file as well!

(117 vote(s))
Not helpful