When using starting OpenVPN as a service it does not use my /etc/openvpn/server.conf. When looking in the /var/log/syslog, I only see Started OpenVPN service. without any additional logging of OpenVPN.

When I start OpenVPN manually, openvpn --config /etc/openvpn/server.conf, I get a bunch of logging of OpenVPN and clients can connect with it.

How do I make sure that when starting it as a service, it uses the config file?

Debian GNU/Linux 9 OpenVPN 2.4.0 x86_64-pc-linux-gnu

  • 1
    What command are you using, service or systemctl? Try systemctl start openvpn@server.service since you're on Debian 9. – Q23 Aug 14 '17 at 20:54
  • I was using just service start openvpn, however the command you provided works! If you add it as an answer I can accept it. :) – joell Aug 15 '17 at 7:58
  • Got it covered. Took me a while to get used to systemctl, so I ended up having this problem often. – Q23 Aug 15 '17 at 23:58
up vote 3 down vote accepted

If you're using a systemd based OS like Ubuntu 16.04 or Debian 9, you'll need to use the systemctl command instead of service:

To enable at boot time:

systemctl enable openvpn@server.service

To start and stop manually:

systemctl start openvpn@server.service

systemctl stop openvpn@server.service

You can enable, disable, start, and stop any OpenVPN configuration this way by replacing server with the name of the .conf file in /etc/openvpn.

  • Thanks for this answer – I had to search a lot until I found that. Weird that service works though and starts OpenVPN, but it just doesn't do anything useful apparently? – slhck Jun 18 at 14:18

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.