Skip to content

Instantly share code, notes, and snippets.

@tsundokul
Created March 4, 2021 10:49
Show Gist options
  • Save tsundokul/916873e94897dea8c770f55faa896b99 to your computer and use it in GitHub Desktop.
Save tsundokul/916873e94897dea8c770f55faa896b99 to your computer and use it in GitHub Desktop.
Add Wireguard user without restarting the service
#!/bin/bash
# call as sudo ./script <key> <ip> <mask> [iface]
iface=${4:-wg0}
wg set peer ${1} allowed-ips=${2}/${3}
wg-quick save ${iface}
ip route add ${2} ${iface}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment