How to set password for wifi AP in OpenWrt?

Hello,
I'm using openwrt, but when it is in AP mode, it does not asks any passwords to connect.
So I want to configure so that one need to enter password to connect, how to configure that using Terminal, I'm not gonna use Luci.

ssh & edit /etc/config/wireless

Hello, my wifi is working fine and I'm able to connect to wifi, but after adding password to my configuration file, I'm able to connect but it does not ask for password.
I restarted openwrt, but still my system connects to it without entering password.
this is my /etc/config/wireless

config wifi-device      ra0
        option type     ralink
        option variant  mt7628
        option country  CN
        option hwmode   11g
        option htmode   HT40
        option channel  auto
        option disabled 0

config wifi-iface ap
        option device   ra0
        option mode     ap
        option network  lan
        option ifname   ra0
        option ssid     VoCore2
        option key      '12345678'
        option encryption psk2

config wifi-iface sta
        option device   ra0
        option mode     sta
        option network  wwan
        option ifname   apcli0
        option ssid     ""
        option key      ""
        option encryption psk2
        option disabled 1

Shouldn't those parameters be in quotes?

config	wifi-iface
	option	device		'wl0'
	option	network		'lan'
	option	mode		'ap'
	option	ssid		'MyWifiAP'
	option	encryption	'psk2'
	option	key		'secret passphrase'
1 Like

I added qoutes but still, It is not asking password.

While you can directly edit system config files, it is usually better to use uci for this:

set:

uci set wireless.default_radio0.key='4SecretPasswd!'
uci set wireless.default_radio1.key='4SecretPasswd!'

review changes:

uci changes

apply:

uci commit wireless
luci-reload