openvpn doesn't find conf files outside /etc/openvpn

Need help configuring your VPN? Just post here and you'll get that help.
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
jhulio
OpenVpn Newbie
Posts: 13
Joined: Sat Feb 27, 2021 1:36 pm

openvpn doesn't find conf files outside /etc/openvpn

Post by jhulio » Sat Feb 27, 2021 1:48 pm

I want to run openvpn as a systemd service.

I downloaded my openvpn configuration files from my VPN provider.

I have one configuration file per VPN server.

I put one of those files inside /etc/openvpn to be recognized my openvpn.

Let's say the file is called /etc/openvpn/server534.conf.

Then I run

Code: Select all

sudo systemctl start openvpn-client@server534
In "server534.conf", I modified this line:

Code: Select all

auth-user-pass
to:

Code: Select all

auth-user-pass /home/myname/vpncredentials.txt
Because in the future I would like to start the service at login without manually inserting username and password.

However, as can be seen by the error logs in "journalctl -xe", the file "/home/myname/vpncredentials.txt" does not exist for openvpn started in this way. A "cat /home/myname/vpncredentials.txt" shows the file correctly.

If I move "vpncredentials.txt" inside /etc/openvpn and modify the configuration file accordingly, it works.

Why openvn does not recognize configuration files outside of /etc/openvpn?

How can I keep my configuration file outside /etc/openvpn?

User avatar
TinCanTech
Forum Team
Posts: 9236
Joined: Fri Jun 03, 2016 1:17 pm

Re: openvpn doesn't find conf files outside /etc/openvpn

Post by TinCanTech » Sat Feb 27, 2021 3:34 pm

You cannot use /home with openvpn and systemd because it is protected. Instead use /etc/openvpn/foo

jhulio
OpenVpn Newbie
Posts: 13
Joined: Sat Feb 27, 2021 1:36 pm

Re: openvpn doesn't find conf files outside /etc/openvpn

Post by jhulio » Sat Feb 27, 2021 4:06 pm

Thanks for your answer.

What does it mean "it is protected"?

What the protection is, how is it called?

Can you point me to bibliographic references to study this protection? :)

User avatar
TinCanTech
Forum Team
Posts: 9236
Joined: Fri Jun 03, 2016 1:17 pm

Re: openvpn doesn't find conf files outside /etc/openvpn

Post by TinCanTech » Sat Feb 27, 2021 5:34 pm

systemd settings

Post Reply