- 
      
- 
        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 | 
      
      
  Author
  
  
        
      
            diogosimao
  
      
      
      commented 
        Nov 18, 2022 
      
    
  
https://askubuntu.com/a/913122
nmcli connection modify enp3s0 ipv4.never-default true
- change enp3s0 with your own connection name.
- use false or true to toggle between this config.
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment