1

i would like to set up few Raspberries access points, that would have different SSIDs but would work with the same hostapd.conf files. For that i thought to define PI_SSID environment variable with different value for each Raspberry in bash file and use it in common hostapd.conf as SSID name.
What i've done so far?
In /home/pi/.bashrc i've added:

export PI_SSID=Razz01

In etc/sudoers i've added:

Defaults env_keep += "PI_SSID"

And in hostapd.conf i've set:

ssid=$PI_SSID

Problem:
After restart of Raspberry PI, its SSID name is "$PI_SSID", not "Razz01".
What i do wrong?
Is it possible at all to define raspberry SSID with environment variable? If yes how to do it?

I use Stretch raspbian.

1
  • The hostapd isn't doing bash-shell-expansion on its config file. You might want to edit this file before initiating the network. Consider using /etc/rc.local to do something like sed -i -s "s/^ssid=.*/ssid=$PI_SSID/" hostapd.conf to differentiate the hostapd.conf files on startup.
    – Dave X
    Commented Dec 11, 2017 at 17:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.