Last active
April 9, 2021 07:17
-
-
Save billz/2cc43e96563293d650e313e068d52dfb to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# Author URI: https://github.com/billz/ | |
# Use /dev/random to generate a strong random passphrase. | |
# If pronounceable, but less secure, passphrases are desired, install gpw (sudo apt install gpw) | |
# and replace it with: gpw 1 24 | |
readonly HOSTAPD="/etc/hostapd/hostapd.conf" | |
readonly PASSPHRASE=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 32 ; echo '') | |
echo "Your new passphrase is: ${PASSPHRASE}" | |
# Update hostapd.conf wpa_passphrase | |
sudo sed -i "s/\(wpa_passphrase=\).*/\1${PASSPHRASE}/g" "$HOSTAPD" || { echo "Unable to modify hostapd.conf" && exit; } | |
# Restart RaspAP for change to take effect | |
sudo systemctl restart raspapd.service || { echo "Unable to restart raspapd.service" && exit; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment