iwconfig - 通过终端上的wifi连接网络

iru*_*eru 10 linux terminal wifi raspberry-pi raspbian

关于覆盆子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".
Run Code Online (Sandbox Code Playgroud)

我也试过了

irukeru@raspberrypi ~ $ sudo iwconfig wlan0 key s:xxxxxxx
Error for wireless request "Set Encode" (8B2A) :
    SET failed on device wlan0 ; Invalid argument.
Run Code Online (Sandbox Code Playgroud)

我是否需要编写密钥的bash代码?

Ola*_*che 14

来自man iwconfig

key/enc [ryption]
用于操作加密或加扰密钥和安全模式.要设置当前加密密钥,只需输入十六进制数字的密钥为XXXX-XXXX-XXXX-XXXX或XXXXXXXX.要设置当前密钥以外的密钥,请在密钥本身前加上或附加[index](这不会更改哪个是活动密钥).您还可以使用s:前缀将密钥作为ASCII字符串输入.目前不支持密码短语.

HBAQXK7W6Y不是十六进制密钥.如果这是ascii键,我认为你应该输入ascii键

sudo iwconfig wlan0 key s:HBAQXK7W6Y
Run Code Online (Sandbox Code Playgroud)

但是:如果这确实是您WLAN的关键,那么您应该尽快更改它.切勿在公共网站上发布密码.

更新:

https://superuser.com/q/42460/164903上也有类似的问题.我想,尤其是这个答案https://superuser.com/a/353818/164903很重要.看起来,iwconfig不支持WPA/WPA2,只支持未加密的网络或WEP,现在基本上是相同的.所以你需要使用其他方法,比如wpa_supplicant.

  • oopps =)我编辑了paswword :)我也尝试了sudo iwconfig wlan0键s:xxxxxxx,但它给出了错误对于无线请求“ Set Encode”(8B2A)的错误:设备wlan0上的SET失败;无效的论点。 (2认同)
  • @irukeru我仍然敦促你选择另一个密码,因为任何人都会看到它的历史. (2认同)