HI Everyone!
Do anyone know how to create and drop SSID's in OpenWRT using a script or ssh like PuTTY?
Cheers,
Sam
HI Everyone!
Do anyone know how to create and drop SSID's in OpenWRT using a script or ssh like PuTTY?
Cheers,
Sam
The files you need to write to are /etc/config/wireless
, /etc/config/network
, and /etc/config/firewall
. Use the GUI to set up an example so you can see the exact syntax to follow.
Be careful about accidentally overwriting the existing files rather than modfying/appending to them.
Thank you, I did that but I want to know if I can do it using some scripts or commands? So that I don't need to write huge list of information like we do using SSH.
Yes, it can be done. If you can SSH to the box, you can pipe a script to the box. If you're using ssh on a Linux box you can pipe a command/script directly. If you're using PuTTY on a Windows box, you can use plink
to achieve the same result.
Do you mean I need to replace PuTTY with plink. If you don't can you explain me with a little more description of how I can do that?
You can even prep the config files in their entirety offline, and use SCP/SFTP to copy them to the target.
https://www.google.com/search?q="how+to+use+plink"
PuTTY is for interactive sessions only. Plink can also be used for interactive sessions, as well as for piping scripts/automated commands to the target.
Windows 10 has built-in SSH nowadays.
I learned a cool trick for configuring from a script...
The uci show wireless
command shows the UCI parameters for the /etc/config/wireless
file. The output starts like this...
root@LEDE-ArcherC7:~# uci show wireless
wireless.radio0=wifi-device
wireless.radio0.type='mac80211'
wireless.radio0.hwmode='11a'
wireless.radio0.path='pci0000:01/0000:01:00.0'
wireless.radio0.htmode='VHT80'
wireless.radio0.country='US'
wireless.radio0.channel='149'
wireless.default_radio0=wifi-iface
wireless.default_radio0.device='radio0'
wireless.default_radio0.network='lan'
wireless.default_radio0.mode='ap'
wireless.default_radio0.ssid='OpenWrt5'
...
To script a change, simply create a uci set ...
command in front of the printed value e.g.
uci set wireless.default_radio0.ssid='OpenWrt5'
to change the SSID of the radio to the indicated string.
PS I use this trick in a script to repeatably configure my newly-flashed router to my desired settings. See https://github.com/richb-hanover/CeroWrtScripts/blob/master/config-cerowrt.sh for an example.
Finally! (See [ How to Enable and Use Windows 10’s New Built-in SSH Commands](https://www.howtogeek.com/336775/how-to-enable-and-use-windows-10s-built-in-ssh-commands/) for example...)
I have updated the SSH Access for Newcomers page. But I still prefer Cmder as an attractive alternative, since it comes with a mini-bash shell for Win10.
Very good point. I'm so accustomed to just editing the /etc/config files directly that I forget about the very useful uci
tool.
Very good example. Thank you for sharing :). I hope it would work for me.
Do anyone know how can we dynamically create and drop ssid? By dynamically I means moving ssid's from one access point to another with a script without writing a huge amount of code.
Let me know if you have any idea about that