running openvpn in the background Debian

This forum is for admins who are looking to build or expand their OpenVPN setup.

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

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
daft_dutch
OpenVpn Newbie
Posts: 7
Joined: Wed May 05, 2021 3:07 pm

running openvpn in the background Debian

Post by daft_dutch » Wed May 05, 2021 3:12 pm

Hi im trying to run openvpn as a service the debian way but i come across a problem.

Code: Select all

May  5 17:08:48 mole systemd[1]: Starting OpenVPN connection to login...
May  5 17:08:48 mole ovpn-login[11787]: Options error: Unrecognized option or missing or extra parameter(s) in /etc/openvpn/login.conf:1: <MYUSERNAME> (2.4.7)
May  5 17:08:48 mole ovpn-login[11787]: Use --help for more information.
May  5 17:08:48 mole systemd[1]: openvpn@login.service: Main process exited, code=exited, status=1/FAILURE
May  5 17:08:48 mole systemd[1]: openvpn@login.service: Failed with result 'exit-code'.
while the config runs fine when i use openvpn script.

Code: Select all

client
dev tun
proto udp
remote nl-ams.prod.surfshark.com 1194
resolv-retry infinite
remote-random
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ping 15
ping-restart 0
ping-timer-rem
reneg-sec 0

remote-cert-tls server

auth-user-pass /etc/openvpn/login.conf

#comp-lzo
verb 3
pull
fast-io
cipher AES-256-CBC

auth SHA512

<ca>
-----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----

-----END OpenVPN Static key V1-----
</tls-auth>
in /etc/openvpn/login.conf i have to lines the username and the password,

can some one help me?

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

Re: running openvpn in the background Debian

Post by TinCanTech » Wed May 05, 2021 4:26 pm

Don't use the name login.conf because your idiotic service wrapper is trying to start it as an openvpn process.

300000
OpenVPN Expert
Posts: 685
Joined: Tue May 01, 2012 9:30 pm

Re: running openvpn in the background Debian

Post by 300000 » Wed May 05, 2021 9:57 pm

if you want to run openvpn automatic from reboot just add on system so it will start openvpn . let open terminal and type

" sudo systemctl enable openvpn@login.conf "

only need to do one time and forget it will do job for you.

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

Re: running openvpn in the background Debian

Post by TinCanTech » Wed May 05, 2021 10:09 pm

300000 wrote:
Wed May 05, 2021 9:57 pm
if you want to run openvpn automatic from reboot just add on system so it will start openvpn . let open terminal and type

" sudo systemctl enable openvpn@login.conf "

only need to do one time and forget it will do job for you.
I think it should be disable ..

And that will not work anyway because it is not systemd at fault but Debian service wrapper ..

daft_dutch
OpenVpn Newbie
Posts: 7
Joined: Wed May 05, 2021 3:07 pm

Re: running openvpn in the background Debian

Post by daft_dutch » Fri May 07, 2021 10:14 am

it works. I renamed login,conf to login.

then a stange thing happend it wanted a client.conf so badly it died it did not exist.
so i made a symlink to my ovpn conf file.
now it works

Post Reply