Automatically connect an Openconnect VPN connection

10,085

Does openconnect work for you?

If so you can use this to connect automatically:

sudo openconnect SERVER --no-cert-check -u USERNAME --passwd-on-stdin  <PASS_FILE

or

echo PASS | sudo openconnect SERVER --no-cert-check -u USERNAME --passwd-on-stdin
Share:
10,085

Related videos on Youtube

My other car is a cadr
Author by

My other car is a cadr

Updated on September 18, 2022

Comments

  • My other car is a cadr
    My other car is a cadr over 1 year

    I installed the network-manager-openconnect package and uses it to login to my Openconnect VPN server. The connection works, except that every time I start the connection a two step dialog box pops up and asks for my VPN username and password:

    enter image description here

    This is the first dialog which asks for the username. If the username is correct, it'll go to the second dialog and ask for the password.

    Is there a way to provide the VPN username and password in a configuration file so that it doesn't ask for it every time? This is important since I'm trying to make this machine headless.

    Or alternatively is there a way to have network-manager-openconnect get the username and password from the keyring, and have the keyring be automatically unlocked after login? I'm using Ubuntu 16.04 LTS Beta 2.

    • Thomas Ward
      Thomas Ward about 8 years
      I'm not sure OpenConnect works that way.
    • Kyle H
      Kyle H over 7 years
      If you run 'man network-manager-openconnect' does it display any options such as --passwd-on-stdin where you could use a shell script to echo your username and password into the network-manager-openconnect so it would auto-connect on boot? When I google the package, I don't see it's man page available online.
    • My other car is a cadr
      My other car is a cadr over 7 years
      I'm getting "No manual entry for network-manager-openconnect" unfortunately.
  • Mehrdad Pedramfar
    Mehrdad Pedramfar over 5 years
    in ubuntu 18.04 openconnect does not have --no-cert-check, any suggestions ?
  • SirSaleh
    SirSaleh about 5 years
    @MehrdadPedramfar For newer openconnect version after you enter this answer's code, error message give you the cert code. and you can use it.