On raspberry pi
irukeru@raspberrypi ~ $ sudo iwconfig wlan0 mode managed
irukeru@raspberrypi ~ $ sudo iwconfig wlan0 channel 11
irukeru@raspberrypi ~ $ sudo iwconfig wlan0 essid linksys
irukeru@raspberrypi ~ $ sudo iwconfig wlan0 key xxxxxxx
Error for wireless request "Set Encode" (8B2A) :
invalid argument "xxxxxxx".
I also tried
irukeru@raspberrypi ~ $ sudo iwconfig wlan0 key s:xxxxxxx
Error for wireless request "Set Encode" (8B2A) :
SET failed on device wlan0 ; Invalid argument.
Should I need to write bash code of my key ?
From man iwconfig
key/enc[ryption]
Used to manipulate encryption or scrambling keys and security mode. To set the current encryption key, just enter the key in hex digits as XXXX-XXXX-XXXX-XXXX or XXXXXXXX. To set a key other than the current key, prepend or append [index] to the key itself (this won't change which is the active key). You can also enter the key as an ASCII string by using the s: prefix. Passphrase is currently not supported.
HBAQXK7W6Y
is not a hex key. If this is the ascii key, I think you should enter it as
sudo iwconfig wlan0 key s:HBAQXK7W6Y
But: if this is really the key for your for your WLAN, you should change it ASAP. Never post a password on a public website.
Update:
There's a similar question at https://superuser.com/q/42460/164903. I think, especially this answer https://superuser.com/a/353818/164903 is important. It seems, iwconfig
doesn't support WPA/WPA2, only unencrypted networks or WEP, which is essentially the same nowadays. So you need to use some other approach, like wpa_supplicant
.