Example: Terminate All Established SSH Sessions on Mac Endpoints

To force termination of all established SSH sessions before setting up the VPN tunnel, reference the following script from a command plist entry for a pre-vpn-connect event. Similarly, you can re-establish the sessions after establishing the GlobalProtect VPN tunnel by using a script that you reference from the command plist entry for a post-vpn-connect event. This can be useful if you want to force all SSH traffic to traverse the GlobalProtect VPN tunnel.
# Identify all SSH sessions and force kill them 
ps | grep ssh | grep -v grep | awk '{ print $1 }' | xargs kill -9 
Code copied to clipboard
Unable to copy due to lack of browser support.

Related Documentation