Change your macOS power settings to prevent disconnecting from VPN/Wi-Fi when the computer is locked
You should always lock your computer when you walk away. But sometimes, that becomes a hassle. Here’s one way to make it easier.
I’m a firm believer in locking your computer when you step away from it for any amount of time. It’s just a habit I’ve formed over decades of computing that has served me well by keeping my data confidential and out of unauthorized hands—this is especially important for those who work in tight quarters with other IT staff, as that can lead to a lot of pranks.
SEE: Identity theft protection policy (TechRepublic Premium)
For those of us who have transitioned home for work, pranksters may not really be much of a concern, but that doesn’t mean there aren’t other very good reasons to lock your computer while away from it. For me, the frustrating thing isn’t unlocking the device each time I return, but the loss of VPN or Wi-Fi connection when locking it, which disrupts anything I’ve been working on.
Apple prides itself in the stellar power management settings for its mobile devices, and while the default configuration is great for most, for remote workers it can be a bit too aggressive by disconnecting from Wi-Fi and VPN anytime the device goes to sleep or gets locked. All these timeouts result in loss of productivity due to constantly having to re-authenticate each time the connections drop. But by modifying a few of settings, this could all be a thing of the past.
How to modify configuration via Terminal
1. Launch Terminal.
2. Enter the following command to change the directory:
cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
3. The following command prevents the wireless connection from disconnecting and to wake the device on network activity respectively:
./airport en0 prefs DisconnectOnLogout=NO
./airport en0 prefs WoWEnabled=YES
4. Lastly, the command below changes the power settings to allow the network connection to keep alive when the computer is locked:
pmset -a network oversleep 1