5

I connect to a VPN server which requires authentication via

/usr/sbin/openvpn --config /etc/openvpn/server.ovpn

This prompts me for a login/password (= OK).

I added the login and password to a file and updated the /etc/openvpn/server.ovpn configuration with

auth-user-pass /etc/openvpn/auth.txt

I am not prompted for the password anymore (= OK).

I wanted to provide the authentication credentials from the command line instead of sourcing them from the config file:

/usr/sbin/openvpn --auth-user-pass /etc/openvpn/auth.txt --config /etc/openvpn/server.ovpn

This time, I am prompted for credentials. Why is it so?

The credentials file is the same, as well as the config (except for the auth-user-pass line which I removed for the last test).

The OpenVPN version is 2.3.10 and it was compiled with enable_password_save=yes (which must be the case since providing the credentials via the config file works, the package is installed from the standard Ubuntu repository)

WoJ
  • 3,607
  • 9
  • 49
  • 79

2 Answers2

11

You have to change position of parameters, --auth-user-pass should be passed after --config parameter like this:

sudo openvpn --config "$HOME/your_file.ovpn" --auth-user-pass "$HOME/auth.txt"
Salman
  • 133
  • 1
  • 2
  • 8
0

Obviously your OpenVPN user is able to access the auth file (otherwise referencing from the config file would have failed).

But just to be sure: is the user you start the OpenVPN connection allowed to read it?

randomnickname
  • 513
  • 2
  • 11