There are a lot of topics concerning this. OpenVPN Auto Connection by putting the conf file to /etc/openvpn just doesnt work. When using the Authentification type "password" an easy way to make it work is:

adding a shell script to /etc/NetworkManager/dispatcher.d (which is executed automatically on network acitivty)


activ_con=$(nmcli con status | grep "${REQUIRED_CONNECTION1_NAME}\|${REQUIRED_CONNECTION2_NAME}")
activ_vpn=$(nmcli con status | grep "${VPN_CONNECTION_NAME}")
if [ "${activ_con}" -a ! "${activ_vpn}" ];
    nmcli con up id "${VPN_CONNECTION_NAME}"

since this causes an error saying the vpn-secret is missing, you have to change the connection config in /etc/NetworkManager/system-connections/myVPN setting


and adding


Now it works fine.

My question is: Is there a way to not put the password in clear text to a conf file. I know its only readable by root but cant i put like a key to it?

  • I only just started with Ask Ubuntu, so please forgive this response for being a "solution" rather than a comment. I came to ask a similar question to yours, after a few hours of research I stumbled upon this neat liike OpenVPN plugin. openvpn-auth-file I'm still trying to get it to work, but it looks promising. Please note that I am not the author of this script, I'm only passing along the knowledge. Good Luck, hope it works for you. – Ten_Ten_Steve Apr 7 '15 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.