Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm connecting using VPNBook servers and it works fine with this command:

 sudo openvpn --config /etc/openvpn/vpnbook-udp-53.ovpn --auth-user-pass /etc/openvpn/password.txt

but I just can't seem to figure out how to stop it without a reboot.

I've tried service openvpn stop and /etc/init.d/vpnbook stop, but that doesn't seem to affect it.

share|improve this question
    
How exactly with ifconfig? – Adam May 23 '13 at 13:59
    
Which one would it be? eth0, lo, tun2, or wlan0 – Adam May 23 '13 at 14:13
    
simply do > sudo /etc/init.d/network-manager restart < – Qasim May 23 '13 at 15:06
    
I am curious, when a VPN is started this way does it not show up in the network manager. I have only always used the network manager connect and disconnect and don't currently have a VPN to test but wondered. – Dennis Feb 19 '14 at 12:49

This command definitely works for me, and it should work for you too.

sudo killall openvpn
share|improve this answer
    
Might require sudo apt-get install psmisc on some builds – geotheory Oct 29 '15 at 22:51

The successful steps in my case were:

# stop the service    
$ sudo /etc/init.d/openvpn stop

# find the process if for some reason it keeps running
$ lsof -i | grep openvpn

# kill the proccess(s) by its PID
$ kill -9 <PID>

# if necessary restart the service again
$ sudo /etc/init.d/openvpn start


For some reason killall -SIGIN openvpn did not work for me, but the steps above did.

share|improve this answer
    
Well, this is the best answer in my opinion. Killing process is the weird method, but requesting the service to stop should do things as it must. – Sopalajo de Arrierez Jul 27 '15 at 22:21

Just hit CTRL+C in the terminal you just started OpenVPN.

share|improve this answer
    
What if it was started w/the -daemon (background) flag? It's not possible in this case. – mr-sk Sep 25 '15 at 22:40
    
Also this leaves 'tun0' as an interface, so it's not possible to restart without rebooting or doing some system config file editing while running. – Dennis Oct 17 '15 at 0:04

Try this

killall -SIGINT openvpn

You can get more info on different signals you can send here: http://openvpn.net/index.php/open-source/documentation/howto.html#control

share|improve this answer
    
killall -SIGINT openvpn openvpn(15360): Operation not permitted openvpn: no process found sudo killall -SICINT openvpn SICINT: unknown signal; killall -l lists signals. – Adam May 23 '13 at 13:57
1  
sudo killall openvpn in a new terminal worked for me. – Adam May 24 '13 at 18:09

sudo update-rc.d openvpn disable

Or edit the config file in /etc/default/openvpn

sudo nano /etc/default/openvpn

And uncomment the line:

#AUTOSTART="none"

So it looks like:

AUTOSTART="none"

Then you'll have to run:

sudo service openvpn start < vpn-name > to manually start the VPN.

sudo service openvpn stop < vpn-name > to manually stop the VPN.

< vpn-name > is the config file name without .conf extension

located in /etc/openvpn and without the < >

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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