I tried using openconnect today for the first time to connect to my organization's VPN. However, once connected, it runs in the foreground of the terminal and the only way I could see to close the connection was to use CTRL-C. Is this an acceptable way to close the openconnect session cleanly? If not, what is the preferred method?
- 2,288
- 5
- 23
- 54
2 Answers
Yes, Ctrl-C (i.e. SIGINT) cleanly shuts it down, according to https://www.infradead.org/openconnect/manual.html#heading5.
Personally I run openconnect in a terminal and use Ctrl-C to shut it down; some people might prefer to use NetworkManager, systemd-networkd, etc. to manage openconnect connections.
- 457
- 4
- 9
To kill openconnect or openconnect-sso ("OpenConnect Single Sign-On (SSO)": a wrapper which allows SAML 2-factor authentication via Okta, in place of the Cisco AnyConnect client) from another terminal, you can send it the Ctrl + C SIGINT interrupt signal safely like this:
# to cleanly kill openconnect or openconnect-sso
sudo pkill --signal SIGINT openconnect
# or (same thing)
sudo pkill -SIGINT openconnect
If you use sudo pkill openconnect instead, it sends the default SIGTERM termination signal instead, which force-kills it and does not kill it cleanly. If you make this simple mistake, simply turn your WiFi card OFF then back ON again by toggling it with Fn + F8 or equivalent (look for the wifi beacon icon) on your laptop keyboard. This resets your internet connection so your internet will work again.
- 2,192
- 1
- 24
- 31