OpenVPN Autologin

I wanted OpenVPN to autologin on one of my servers.  The issue here is two fold: UAC grabs the executable and demands confirmation, and the gui doesn’t retain credentials.  The solution to the latter does unfortunately require storing those credentials plaintext in a file, but if you’re not worried about that then read on.

Head to the config directory in the OpenVPN install path (typically C:\Program Files\OpenVPN\config).  Create a text file in here.  On the first line of the file, enter your username.  On the second, your password. Save it.  Select the ovpn config file of your choosing and open it in a text editor.  In that file, where you see auth-user-pass, add the name of your newly created text file to the end.  Eg: auth-user-pass creds.txt. Note the space between pass and creds.  Save the file.

Kick open Task Scheduler and choose to create a new basic task.  Set it to run At log on.  For action, choose Start a program and point it to openvpn-gui.exe with the full path, and add the argument –connect theovpnfileyoumodified.ovpn. You may need to add the executable base path to the Start in as well.

openvpn

Make sure that you’ve set it to Run with the highest privileges:

openvpn2

Save your task and right click to test run it.  It should fire up OpenVPN and log in automatically, without any prompting.

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*