Connect to VPN without typing my password

Asked by Kamil Slowikowski

I want network-manager to remember my VPN password, so that I never need to type it ever again.

I already successfully achieved this behavior, but it was by circumventing network-manager with
modified files as described below. I have tried many different solutions suggested on askubuntu and
other sites I found by Googling. No solution worked, except for this one.

Unfortunately, these file modifications no longer work for some unknown reason, so I'm
back to typing the VPN password again.

BEGIN /etc/network/interfaces

auto lo
iface lo inet loopback
# I added the following 4 lines:
auto eth0
iface eth0 inet dhcp
name Wired-LAN
post-up /etc/network/if-up.d/VPNNAME

END /etc/network/interfaces

BEGIN /etc/network/if-up.d/VPNNAME

#!/usr/bin/env bash
    -U MyLaptopUser
    -u MyVPNUser
echo "my vpn password" | sudo openconnect ${opt[*]}

END /etc/network/if-up.d/VPNNAME

I'm using:

Ubuntu 12.04

Question information

English Edit question
Ubuntu network-manager Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :

If you use key files you won't need to type passwords.

Revision history for this message
Kamil Slowikowski (kslowikowski) said :

Perhaps you could elaborate.

Revision history for this message
actionparsnip (andrew-woodhead666) said :

try this solution

add this line to your openvpn clients config file

auth-user-pass login.conf

create new file named login.conf and then add your clients username and password


Revision history for this message
actionparsnip (andrew-woodhead666) said :

Can you help with this problem?

Provide an answer of your own, or ask Kamil Slowikowski for more information if necessary.

To post a message you must log in.