5

On my Ubuntu 16.04 server, I have the OpenVPN service running as the user nobody. How can I restart the service or reload the config file for the service using, for instance, systemctl?

An openvpn process is running, but I don't know how to access it.

310 nobody    20   0   44440   3184   1968 S  0.0  0.3   1263:30 openvpn

The command su nobody does not work because no password is set. Is there an alternative?

7

Try this, I've noticed that restart doesn't work for me.

sudo systemctl stop openvpn@server
sudo systemctl enable openvpn@server.service
sudo systemctl start openvpn@server
| improve this answer | |
5

OpenVPN is a templatized service under systemd. The services are named openvpn@config.service. So you should restart your /etc/openvpn/myvpn.conf instance with:

systemctl restart openvpn@myvpn.service
| improve this answer | |
  • The trouble is using systemctl status openvpn@myvpn.service doesn't reveal an active service when doing this under my login or under root user, as I assume the service is running under the nobody user – sumade Aug 20 '17 at 22:30
2

Go to the this directory and take a look at files:

sudo su

cd /etc/systemd/system/multi-user.target.wants

ls

there should be a file in this format (could be different depend on openvpn version):

openvpn-server@server.service

or

openvpn@server.service

if you see multiple files in this format, it's because you probably use this code before:

sudo systemctl enable openvpn-something@server.service

this self-made files (created by enable) does nothing and could be removed later. But for now you should find the one works well with this commands without causing any error:

sudo systemctl stop <openvpn-server@server.service>
sudo systemctl start <openvpn-server@server.service> 

and replace with all files in this format (starts with openvpn and ends with .service) in the directory. The one that truly stops and starts openvpn service is the file you need and others could be removed (you shouldn't have made them in first place by enabling them):

sudo rm <openvpn-selfMadeFiles@server.service>

Be careful to not to remove the one that is making the service start and stop

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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