Ubuntu – Openconnect keeps asking for username in Ubuntu 20.04

20.04network-manageropenconnectvpn

I recently have upgraded to Ubuntu 20.04. Everything works fine except that every time I want to connect to a VPN network with openconnect I have to enter My username and It asks me to validate the certificate. I connect to VPN network using a gnome plugin for openconnect: "network-manager-openconnect-gnome". This can be very frustrating since I have to switch between VPN connection and normal Internet connection frequently.

Best Answer

I found a solution by modifying manually the vpn configuration file in the /etc/NetworkManager/system-connections/ folder.

  1. First close any active VPN connection
  2. Close the VPN GUI
  3. Open with root privilege the file corresponding your VPN settings in the /etc/NetworkManager/system-connections/ folder,
  4. Then find the vpn-secrets section and add your credentials
    [vpn-secrets]
    form:main:group_list=FOO
    form:main:username=foo@bar.net
    lasthost=vpn.bar.net
    save_passwords=yes
  1. Save, close (don't open VPN GUI before reboot) and reboot

Enjoy your automatic VPN login..