Saving Username/Password

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

thepodger
OpenVpn Newbie
Posts: 2
Joined: Tue Nov 04, 2014 2:49 pm

Re: Saving Username/Password

Post by thepodger » Tue Nov 04, 2014 2:56 pm

I have followed the "auth-user-pass password.txt" directions in Vista using V5 of the client and have yet to have any luck. Will update this post with the config settings soon. I suspect the OS is the issue. Will keep working on it a report findings here.

thepodger
OpenVpn Newbie
Posts: 2
Joined: Tue Nov 04, 2014 2:49 pm

Re: Saving Username/Password

Post by thepodger » Wed Nov 05, 2014 1:37 am

Here is my config file. As you can see, I have used the "Path-to-config-dir\\password.txt" format, but it has not worked for me.
I run the VPN program with this edited and the log does not register anything at all. I am sure it is a simple layout issue.
Any advice would be very welcome. BTW, I am using this with pfsense, a very solid, feature-rich, Open Source firewall is you are looking for one. Being able to save the user and pass for this client would be nice.
URL for pfsense: https://www.pfsense.org/

====Start of File ========
dev tun
persist-tun
persist-key
cipher AES-128-CBC
auth SHA1
tls-client
client
resolv-retry infinite
remote 50.74.48.226 1196 tcp-client
lport 0
verify-x509-name "Redacted-UserName" name
auth-user-pass "C:\Program Files\OpenVPN\config\\login.conf"
pkcs12 bpbuster-TCP-1196-FredK.p12
tls-auth bpbuster-TCP-1196-FredK-tls.key 1
comp-lzo
passtos

kpirlo
OpenVpn Newbie
Posts: 1
Joined: Mon Nov 24, 2014 3:36 pm

Re: Saving Username/Password

Post by kpirlo » Mon Nov 24, 2014 3:39 pm

I didn't see this mentioned in here yet, but I was trying to get this to work also and the only thing that worked for me was using the old style path (progra~1):

auth-user-pass "C:\\Progra~1\\OpenVPN\\config\\pass.txt"

Hope this helps someone else.

Sheepdisease
OpenVpn Newbie
Posts: 2
Joined: Tue Dec 02, 2014 9:34 pm

Re: Saving Username/Password

Post by Sheepdisease » Wed Dec 03, 2014 6:03 pm

I am having the same problem as above and wonder if someone could please assist?

Globule
OpenVpn Newbie
Posts: 1
Joined: Wed Dec 31, 2014 8:38 am

Re: Saving Username/Password

Post by Globule » Wed Dec 31, 2014 8:38 am

Check your client config file on your PC. You may have another entry auth-user-pass

Comment out the second one

User avatar
Traffic
OpenVPN Protagonist
Posts: 4066
Joined: Sat Aug 09, 2014 11:24 am

Re: Saving Username/Password

Post by Traffic » Wed Dec 31, 2014 1:00 pm

thepodger wrote:auth-user-pass "C:\Program Files\OpenVPN\config\\login.conf"
Can you not see the error ?

Code: Select all

auth-user-pass "C:\Program Files\OpenVPN\config\\login.conf"
# Replace with:
auth-user-pass "C:\\Program Files\\OpenVPN\\config\\login.conf"
You can also use this in OpenVPN:

Code: Select all

auth-user-pass "C:/Program Files/OpenVPN/config/login.conf"

KWhite
OpenVpn Newbie
Posts: 1
Joined: Tue Jan 06, 2015 11:23 am

Re: Saving Username/Password

Post by KWhite » Tue Jan 06, 2015 11:33 am

openvpn@aetm.us wrote:I tried all these tips, with and without the full path, and then including the double "\\". That line in the .ovpn file now reads:
auth-user-pass "C:\\Program Files\\OpenVPN\\config\\login.conf"

OpenVPN still prompts me for a user and pass. Help!

Just create a new file using Notepad++

type in just 2 rows:
[username]
[pass]

your file should look like this:

John_Doe
mypassword

Go to Save As and select the config folder of your OpenVpn install (i.e. C:\Program Files\OpenVPN\config)
Save as "login.conf" . Select filetype "All Files".

Add to your .ovpn connection profile :

auth-user-pass login.conf

**Make sure this is the only line in the file like "auth-user-pass"

Save.

Connect.

This was the only way i could get it working on OpenVPN GUI v5-A.
Whenever i tried with a .txt pass file i would get " no such directory/ file...etc", even though the path was correct.

comeback1106
OpenVpn Newbie
Posts: 3
Joined: Wed Mar 04, 2015 7:17 am

Re: Saving Username/Password

Post by comeback1106 » Wed Mar 04, 2015 7:38 am

xauen wrote:1. Create a txt file on a folder alongside your .ovpn files name it what ever you want ex. 'pass.txt'
2. Put your user/pass inside the file in two(2) lines, like:

Code: Select all

username
password
3. Then save it.
4. open up your .ovpn file in notepad and add:

Code: Select all

auth-user-pass pass.txt
5. save and connect to your openvpn server.
I have try this way and this work for me. But more question, Can I include the password to this ovpn file? Thanks.

mrdiegoa
OpenVpn Newbie
Posts: 1
Joined: Fri May 15, 2015 10:42 am

Re: Saving Username/Password

Post by mrdiegoa » Fri May 15, 2015 10:46 am

Hi everybody.

Is there a means of storing just the login, without the password? The desired behavior would be that of the login/password dialog box appearing to the user already compiled in the login field.

Thanks,

Diego

oshliaer
OpenVpn Newbie
Posts: 1
Joined: Fri Oct 16, 2015 8:35 am

Re: Saving Username/Password

Post by oshliaer » Fri Oct 16, 2015 8:43 am

Hi! Just an additional.

"auth-user-pass" is enough for the normal job.
If you are using Windows you should to save the login/pass file to ASCII. Not UTF-8 or other.

It means using the notepad with default settings is a good idea.

Cheers!

freedomClub
OpenVpn Newbie
Posts: 2
Joined: Thu Oct 29, 2015 7:22 am

Re: Saving Username/Password

Post by freedomClub » Thu Oct 29, 2015 7:25 am

On windows the password file (eg. "login.conf") needs to be in:
1. DOS file format
2. Not UTF-8

freedomClub
OpenVpn Newbie
Posts: 2
Joined: Thu Oct 29, 2015 7:22 am

Re: Saving Username/Password

Post by freedomClub » Thu Oct 29, 2015 7:28 am

In windows the passwords file (eg. login.conf) needs to be:
1. DOS file format
2. Not UTF-8

thelimey
OpenVpn Newbie
Posts: 1
Joined: Thu Aug 08, 2013 3:13 pm

Re: Saving Username/Password

Post by thelimey » Tue Feb 16, 2016 6:52 pm

LOL. I had this issue, and eventually worked out it was because I was an idiot....

I forgot that:
1) Windows hides file extensions
2) notepad adds .txt to the file name

So OpenVPN was correct that the file login.conf didn't exist because it was actually named login.conf.txt

I tried with Notepad++ after others said that was the way they got it to work. It saves the file with the name you specify, without adding an extra .txt, that was when I realised what had happened.

joutcast
OpenVpn Newbie
Posts: 2
Joined: Fri Dec 09, 2016 10:32 pm

Re: Saving Username/Password

Post by joutcast » Fri Dec 09, 2016 10:43 pm

Not attempting to be captain obvious here, and please correct me if this is not getting over looked. However, I have not seen anyone specifying to insert the file name at the header of the file.... the only way it works for me is outlined below. This example assumes login.conf is the credentialing file and in the same directory.

In YourConnection.ovpn on auth-usr-pass line:

auth-usr-pass "./login.conf"

In your login.conf file:

login.conf
YourUserName
YourPassword

joutcast
OpenVpn Newbie
Posts: 2
Joined: Fri Dec 09, 2016 10:32 pm

Re: Saving Username/Password

Post by joutcast » Fri Dec 09, 2016 11:27 pm

Sorry it is "auth-user-pass" lol

User avatar
disqualified
OpenVPN User
Posts: 40
Joined: Fri Jun 03, 2016 7:13 pm

Re: Saving Username/Password

Post by disqualified » Fri Dec 09, 2016 11:30 pm

joutcast wrote:auth-us(e)r-pass "./login.conf"
Do not name your file login.conf :roll:

minions
OpenVpn Newbie
Posts: 4
Joined: Wed Jul 26, 2017 12:03 am

Re: Saving Username/Password

Post by minions » Wed Jul 26, 2017 12:07 am

I found the answer!

I know this is pretty dang old but I figure there are some out there like me who came across this while trying to find the answer.

I also found this: https://community.openvpn.net/openvpn/ticket/697

Which gave me the answer. If you notice, it is a ticket and the answer is given by OpenVPN staff themselves, so that should instill confidence. In any case, it worked for me while no other post listed in this thread worked.

What you need to do is add this to your *.ovpn file:

Code: Select all

askpass "C:/Program Files/OpenVPN/config/[filename].conf"
Then create that .conf file with ONLY your password.

It should work! Sorry if it doesn't! I'm just passing on what worked for me and what I believe works.

Good luck!

msoldier55
OpenVpn Newbie
Posts: 1
Joined: Thu Oct 26, 2017 1:24 am

Re: Saving Username/Password

Post by msoldier55 » Thu Oct 26, 2017 1:25 am

This solution works. However, what if the VPN requires a group. I am using a Windows environment.

When I use Cisco AnyConnect, I specify a group, username and password. What is the equivalent in the config file?

Thanks.

Max

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Saving Username/Password

Post by TinCanTech » Thu Oct 26, 2017 10:20 am

msoldier55 wrote:
Thu Oct 26, 2017 1:25 am
what if the VPN requires a group
Openvpn only supports username and password.

Sumku
OpenVpn Newbie
Posts: 1
Joined: Sun Sep 27, 2020 6:41 am

Re: Saving Username/Password

Post by Sumku » Sun Sep 27, 2020 6:43 am

joutcast wrote:
Fri Dec 09, 2016 10:43 pm
Not attempting to be captain obvious here, and please correct me if this is not getting over looked. However, I have not seen anyone specifying to insert the file name at the header of the file.... the only way it works for me is outlined below. This example assumes login.conf is the credentialing file and in the same directory.

In YourConnection.ovpn on auth-usr-pass line:

auth-usr-pass "./login.conf"

In your login.conf file:

login.conf
YourUserName
YourPassword
You know, I had searched at so many places and tried so many different things that when your suggestion finally worked, I just could not resist the urge to create Profile just so that I can say "Thank You". Solved for Me. Greatly Appreciated.

Post Reply