1

I have an Ubuntu 14.04 Server with an OpenVPN Server running on it. Now for backup purposes I want this machine to create a VPN connection to a seperate machine.

I figured out that I can create a new client instance using this code:

openvpn --config openvpn.ovpn --auth-user-pass auth --auth-nocache --nobind &

where "auth" is a file containing a username and password for the connection.

This seems work fine, but the problem is that I have no idea how to close the connection after it has been opened (I do not know if this is the best solution).

I only need the connection during a backup process and it is important that the VPN server stays active, so solutions like "killall" and "restart" are not an option.

The Ubuntu Server is running without a User Interface. So I can only use command line.

1 Answer 1

1

get ID of your process:

openvpn --config openvpn.ovpn --auth-user-pass auth --auth-nocache --nobind > /dev/null & pid=$!

Stop that process:

kill $pid

3
  • Definitely works for root. That should be fine. Thanks. Mar 7, 2016 at 13:26
  • Just one addition: Will the server and client get in each others way when doing this? Mar 7, 2016 at 13:32
  • only if you try to bind both to same interface (tap0 or tun0). make client to work in different subnet on another interface - and you can connect to as many server as you like. Mar 7, 2016 at 14:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .