There are many posts about putting VPN passwords into /etc/NetworkManager/system-connections/<connection>
. I can't get any of them working on Ubuntu 12.04. The fields in the questions and answers seem subtly different from mine. The one that came closest seemed to be: How to save VPN passwords with NetworkManger.
I'd prefer to have nmcli
ask for passwords on the console instead of in a GUI widget on the desktop, but that seems impossible.
So two questions:
- Are the
/etc/NetworkManager/system-connections/<connection>
files and their fields officially documented anywhere? There seem to be many 404s for NetworkManager documentation links. - What is wrong with my connection file?
Here is my conneciton file. I've tried many variations of settings in this file, but this is as close to good as I could come up with (anonymized of course):
[connection]
# Not sure if this helps or breaks anything. Fails regardless.
permissions=user:peter:;
id=My VPNC
uuid=a2cd97d5-7df1-4391-91d8-7e72931ec2de
type=vpn
autoconnect=false
timestamp=1396942441
[vpn]
service-type=org.freedesktop.NetworkManager.vpnc
NAT Traversal Mode=natt
ipSec-secret-type=save
IPSec secret-flags=0
xauth-password-type=save
Vendor=cisco
Xauth username=user
IPSec gateway=1.2.3.4
XAuth password-flags=0
IPSec ID=Ipsec
Perfect Forward Secrecy=server
IKE DH Group=dh2
[vpn-secrets]
XAuth password=password
IPSec secret=grouppassword
[ipv4]
method=auto
Permissons:
> ls -l /etc/NetworkManager/system-connections/My\ VPNC
-rw------- 1 root root 527 Apr 8 10:11 /etc/NetworkManager/system-connections/My VPNC
Running it gives:
> sudo nmcli con up id 'My VPNC'
Active connection state: unknown
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/44
state: VPN connecting (need authentication) (2)
Error: Connection activation failed: no valid VPN secrets.
Edit: Here is another similar post (about Openconnect VPN though): How can I get NetworkManager to autoconnect to a Openconnect VPN via nmcli without prompting for a user and password
Best Answer
When you set up your VPN connection through the GUI the password is saved in the key-ring. If you save your password in the connection file, like this: