- 
      
- 
        Save diogosimao/10df4e750c982b390d5696c08ccc63a0 to your computer and use it in GitHub Desktop. 
    Set up a bunch of OpenVPN connections using nmcli with username and password
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env bash | |
| USERNAME="$1" | |
| PASS="$2" | |
| for f in *.ovpn | |
| do | |
| name=`basename -s .ovpn $f`; | |
| nmcli connection import type openvpn file $f | |
| nmcli connection modify "${name}" +vpn.data connection-type=password-tls | |
| nmcli connection modify "${name}" +vpn.data username="${USERNAME}" | |
| nmcli connection modify "${name}" +vpn.secrets password="${PASS}" | |
| done | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
https://askubuntu.com/a/913122