Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I managed to setup openvpn but now I want to integrate a user/pass authentication method so, even though I haven't added the auth-nocache in the server config, whenever I try to connect it returns with the following message on the client side:

ERROR: could not read Auth username from stdin

My server.conf file contains basic stuff, everything works up untill I try to implement this for of authentication.

mode server
dev tun
proto tcp
port 1194

keepalive 10 120

plugin /usr/lib/openvpn/ login


auth-user-pass-verify /etc/openvpn/ via-env

ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem

user nobody
group nogroup


status openvpn-status.log
verb 3

push "redirect-gateway def1"
push "dhcp-option DNS"
log-append /var/log/openvpn

I searched all over the net for a solution and all answers seems to be related to the auth-nocache param which I haven't set.

The directive auth-user-pass-verify /etc/openvpn/ via-env points to a script which is executed to perform the authentication. A false authentication should result in a exit 1 while a true one should result with exit 0. For testing, that script returns exit 0 no matter what the input is but it seems that the file is not executed before the error raises. file contents:


my $user = $ENV{username};
my $passwd = $ENV{password};

printf("$user : $passwd\n");
exit 0;

Any ideas?

share|improve this question
does have execution permission ? – zb' Nov 7 '12 at 5:18

Have you tried providing the script-security 3 option to allow openvpn to run external programs?

Although a better solution for requesting a password would probably be to setup OpenVPN to listen on a management port and to be hold. You can write a script/interface that will collect the credentials from the user and then you can make a socket connection and provide the credentials and release the hold.

share|improve this answer
Setting script-security 3 didn't help unfortunately. I still receive the same message. Openvpn keeps asking for username and password. – user56231 Oct 12 '10 at 12:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.