OpenVPN user/password authentication

How to add an OpenVPN user/password authentication to a DD-WRT OpenVPN server.

This is a shameless rip-off from Dagger and SgtPepperKSU, kudos!

First log in to your DD-WRT router (
Go to Administration >> Commands
Add the following text in the “Commands” text box:

echo ‘#!/bin/sh
pass=`awk “\\\$1 == \”${username}\” { print substr(\\\$0,length(\\\$1)+2) }” /tmp/openvpn-auth`
test -n “$pass” && test “$pass” == “${password}” && exit 0
exit 1’ > /tmp/
chmod 755 /tmp/

echo ‘
user1 pass1
user2 pass2
user3 pass3
‘ > /tmp/openvpn-auth

Press <Run Commands>
Press <Save Startup>


Go to Services >> VPN
Scroll down to “Additional Config” and add the following text to the already existing one:

script-security 3
auth-user-pass-verify /tmp/ via-env

Press <Save>


Press <Apply Settings>

Now update the client (e.g. ClientName2).
Run OpenVPN client GUI as administrator.


Right-click the OpenVPN GUI and left-click <Edit Config>.


Add the following text and save the file:



Right-click the OpenVPN GUI and left-click <Connect>


Type your login (user1) and password (pass1) and press <OK>.
Wait a while for the connect message.


If connected, you successfully added a user/password authentication to your DD-WRT OpenVPN server, congrats!

Leave a Reply