Skip to content

Instantly share code, notes, and snippets.

@jd-boyd
Created July 13, 2019 16:52
Show Gist options
  • Save jd-boyd/1243b0dc3bc64927a6e8332860f707d0 to your computer and use it in GitHub Desktop.
Save jd-boyd/1243b0dc3bc64927a6e8332860f707d0 to your computer and use it in GitHub Desktop.
Dynamically Create SSID for Linux AP Hotspot
make_ssid.sh goes in /etc/hostapd/
The service file goes in /etc/systemd/system/
[Unit]
Description=Setup ssid to use for hostapd
Before=hostapd.service
[Service]
Type=oneshot
ExecStart=/bin/bash /etc/hostapd/make_ssid.sh
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
#!/bin/bash
set -e
egrep -v "^ssid" /etc/hostapd/hostapd.conf > /tmp/hostapd.new
grep Serial /proc/cpuinfo | awk '{ print "ssid=example_ssid_" $3 }' >> /tmp/hostapd.new
mv /tmp/hostapd.new /etc/hostapd/hostapd.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment