Wireguard VPN setup

Just spent more time than willing to admit I finally got it working by adding sudo to the front of both commands… sigh. I guess you could change the file permissions as well. Hopefully this works for you too

Add this code to /rw/config/rc.local

RANDOM_VPN=$(sudo nmcli connection show | awk '/wireguard/ { print $1 }' | sort -R | head -n 1)
sudo nmcli connection up "$RANDOM_VPN"
1 Like