Skip to content

Instantly share code, notes, and snippets.

@notpike
Created March 1, 2023 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notpike/01762cb5782c0757080106be8a1cb392 to your computer and use it in GitHub Desktop.
Save notpike/01762cb5782c0757080106be8a1cb392 to your computer and use it in GitHub Desktop.
Import .ovpn files to Network Manager
#!/bin/bash
UNAME=""
PASS=''
echo "== START =="
for file in *; do
if [ -f "$file" ]; then
if [ ${file: -5} == ".ovpn" ]; then
echo "Importing" ${file::-5}
nmcli connection import type openvpn file "$file"
nmcli con modify "${file::-5}" vpn.user-name $UNAME
nmcli con modify "${file::-5}" vpn.secrets password=$PASS
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment