Where is "openvpn.conf" located?

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Captain Brillo

Where is "openvpn.conf" located?

Post by Captain Brillo »

As per this article https://www.maketecheasier.com/connect- ... lly-linux/

Trying to automate VPN connection and these instructions are giving me a problem:
Open “/etc/openvpn/openvpn.conf” with sudo. Look for a line that contains “auth-user-pass.” It’ll probably be sitting there alone with nothing else on the line. After it, add “auth.txt” on the same line. Save the file and close it.

Create a new file in “/etc/openvpn” called “auth.txt.” On the first line of the file, place your username. Include your password on the second line. There is no need for anything else in the file. Save and close it.
I've tried "storing" the password for every user in "Network Connections" but that doesn't work.
Can't find that conf file, so where is it that I automate this?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Where is "openvpn.conf" located?

Post by rene »

/etc/openvpn/openvpn.conf is actually something you have to create and which is specific for each VPN provider and server and protocol (TCP and UDP) thereof; you can usually download the files (generally named e.g. us-123.foovpn.com.udp1194.ovpn) from the VPN provider; I keep e.g. FooVPN's .opvn files in /etc/openvpn/client/FooVPN and link the one I aim to in fact use as /etc/openvpn/openvpn.conf.

That is however not generally advisable. NetworkManager manages multiple VPN connections nicely: what does not work for you? If you want to map multiple FooVPN usernames onto a single Linux user just create multiple VPN connections, one for each FooVPN username.

So as to use NetworkManager: click network icon in systray -> Network Connections -> + -> Import a saved VPN configuration -> Create -> browse to an .ovpn file as mentioned above as well and as downloaded from FooVPN -> Add e.g. "(username)" to the connection name and fill in the FooVPN username and password -> Save.
Captain Brillo

Re: Where is "openvpn.conf" located?

Post by Captain Brillo »

Thanks, but that's not the problem; I've put the password there for all users, doesn't help at startup, I'm still asked for the password.

What I'm trying to do is automate openvpn connection at startup without needing to enter any password info.
As the referenced article says, I need to find the file with this in it (look at the link!):
cipher AES-256-CBC
auth SHA512
tls-cipher TLS...
...
nobind
auth-user-pass...
So far I can't find it.

I don't know how to automate this without somebody else's app/program; the article mentioned above shows how to do this, if I can find the right file to edit.

The desired result will be seamless VPN connection at startup.
User avatar
Pippin
Level 4
Level 4
Posts: 441
Joined: Wed Dec 13, 2017 11:14 am
Location: The Shire

Re: Where is "openvpn.conf" located?

Post by Pippin »

Code: Select all

auth-user-pass /etc/openvpn/passwordfile
;)
I gloomily came to the ironic conclusion that if you take a highly intelligent person and give them the best possible, elite education, then you will most likely wind up with an academic who is completely impervious to reality.
Halton Arp
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Where is "openvpn.conf" located?

Post by rene »

Captain Brillo wrote: Fri Dec 28, 2018 6:41 pm So far I can't find it.
As I spelled out already, you need to create /etc/openvpn/openvpn.conf. The by yourself linked article does so by copying a by the VPN provider provided .ovpn file; I myself suggested to simply link that file. Whichever way, the .ovpn file you should get from your VPN provider.
Last edited by rene on Fri Dec 28, 2018 7:09 pm, edited 1 time in total.
User avatar
Gruppo Sportivo
Level 4
Level 4
Posts: 276
Joined: Sun May 28, 2017 4:14 am
Location: 🇳🇱

Re: Where is "openvpn.conf" located?

Post by Gruppo Sportivo »

Try this:

Code: Select all

sudo nano /etc/openvpn/login.conf
Add 2 lines for login and password. Line one is going to be your VPN access login and line two is going to be your password. To save and exit Nano press CTRL -x it will ask you to save it type Y

Set the proper permissions for the conf file:

Code: Select all

sudo chmod 400 /etc/openvpn/login.conf
Create a new config file with your VPN information name.ovpn

Code: Select all

sudo cp name.ovpn /etc/openvpn/name.conf
By adding the new line OpenVPN automatically knows where to grab the password:

Code: Select all

sudo nano /etc/openvpn/name.conf
At the line auth-user-pass add login.conf so it looks exactly like auth-user-pass login.conf
Captain Brillo

Re: Where is "openvpn.conf" located?

Post by Captain Brillo »

My bad.
And thank you.
I just wasn't getting the "create" part.

Got it now.... :oops:
Locked

Return to “Networking”