My Mac Book pro with 10.11.2 has this annoying feature that it disconnects Cisco AnyConnect VPN every time I lock the screen.

I found some instructions on how to prevent Wi-Fi disconnection when locking the screen, but I could not apply those instructions to the AnyConnect network. I´m usually connected with Ethernet cable, if that matters.

Is there some way to disable such feature?

  • Did you find a solution to this? – thenakulchawla Jul 3 '18 at 19:51


Launch Terminal and run:

ifconfig | grep -B 6 'status: active' | head -n 1 | cut -d : -f 1

Then run (replace en0 below with the output of the command above):

cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
sudo ./airport en0 prefs DisconnectOnLogout=NO
sudo pmset -a sleep 0

Long version

I am on MacOS Mojave (10.14).
For me this helped against automatically disconnecting from Cisco AnyConnect while on WiFi:

Open the Terminal app and paste:

ifconfig | grep -B 6 'status: active' | head -n 1 | cut -d : -f 1

This returned:


Then type (replace en0 on line 2 with the returned value above):

cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
sudo ./airport en0 prefs DisconnectOnLogout=NO

Type your password.
Check if the setting was saved by typing:

sudo ./airport prefs

Which should return this:

AirPort preferences for en0:

Unable to retrieve JoinMode

DisconnectOnLogout should be set to NO.

Next, prevent the system from going to sleep after locking:

sudo pmset -a sleep 0

That should do the trick, worked for me.


I have the same problem - my internet connection is 10/100 USB LAN. If I have Cisco anyconnect connected to the vpn and lock the screen it drops the vpn. The screensaver locking it seemed to not disconnect.

I am on 10.11.6 - El Capitan.

I use the lock screen solution described here:

MBP Lock screen hotkey without sleeping?

Did you find a solution? This is widely reported when people have wifi connections and lock the screen but there seem to be many potential solutions with nothing definitive. Your post seems to be somewhat unique in that it is a wired setup like mine. Any thoughts appreciated.


I was able to do this with the free version of Alfred by

  1. Forcing password on the screen saver in the OS settings (https://support.apple.com/en-us/HT204379)
  2. Disabling Alfred from controlling the OS X Lock (optional)
  3. Setting up Alfred to use lock or l (I use the latter) for controlling the screen saver

enter image description here

I understand this method won't work without Alfred, but I find it very a convenient way to quickly lock my screen without dropping VPN connections. I also understand that there may be differences in how this method differs from the OS X Lock functionality.

You must log in to answer this question.

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