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
opt=(
    -U MyLaptopUser
    -u MyVPNUser
    --background
    --authgroup=MyAuthGroup
    --no-dtls
    --script=/etc/vpnc/vpnc-script
    --pid-file=/tmp/openconnect.pid
    --passwd-on-stdin
    vpn.hostname.org
)
echo "my vpn password" | sudo openconnect ${opt[*]}

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

I'm using:

Ubuntu 12.04
network-manager 0.9.4.0-0ubuntu4.4.1
network-manager-openvpn 0.9.4.0-0ubuntu1

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu network-manager Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

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

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

Perhaps you could elaborate.

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

try this solution

add this line to your openvpn clients config file

Quote:
auth-user-pass login.conf

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

Quote:
username
password

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

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.