This script is to solve the problem that the Cisco anyconnect client cannot remember the password. You need to enter the password every time you start the client.
- Make sure the Cisco anyconnect client is installed on the system
- Edit the script to modify the value of the
CONN_INFO
array The format is"VPN_ADDRESS USERNAME PASSWORD"
, one per line, there is a space between the address and the username, there is a space between the username and the password, be careful not to forget the double quotes ("")Save and exit the script after the modification is complete... CONN_INFO=( "VPN_ADDRESS USERNAME PASSWORD" "vpn.github.com:8843 zhangsan 123456" ) ...
- Execute the script
You can add an alias to this script, and execute the alias every time. For example
chmod +x ./connect-vpn.sh ./connect-vpn.sh
In this way, you can executeecho "alias conn='/Users/zhangsan/scripts/connect-vpn.sh'" >> ~/.zshrc source .zshrc
conn
every time in the terminal. - Script parameter description
-h, --help Show this help message. -c|-con|-conn|-connect, --c|--con|--conn|--connect Connect VPN Server. -d|-dis|-disconn|-disconnect, --d|--dis|--disconn|--disconnect DisConnect VPN Server. -r, --r|--reconn|--reconnect Reconnect VPN Server. -s|-state|-status, --s|--state|--status View VPN connection status. -stats, --stats View VPN Statistics.