Cisco Anyconnect login from cli

Let's get rid of some password prompting shall we?

2021-04-24

Log in to Cisco AnyConnect from cli

Please note that none of this will work if the GUI is running, so exit from it first.

  • Create a file named .credentials
  • Put your login info there, replace the infomation, no brakets needed:
    connect [HOSTNAME]
    [0] // this is your group number if you have one, you can skip this
    [USERNAME]
    [PASSWORD]
    \n
  • Now we can connect like this:
    /opt/cisco/anyconnect/bin/vpn -s < .credentials

Let`s create some aliases

Speaks for itself right?

  • alias vpn-connect="/opt/cisco/anyconnect/bin/vpn -s < ~.credentials"
  • alias vpn-drop="/opt/cisco/anyconnect/bin/vpn disconnect"
  • alias vpn-status="/opt/cisco/anyconnect/bin/vpn exit"

You may have to add these to your .zshrc file if your zsh is not configured propery.

And that's it. Now you can schedule the command to start on boot time. I'll update the article with that later. 

This site is using Google Analitics Privacy Policy and Terms of Service.