Ubuntu – How to setup Wifi using the command-line

command linewireless

How do I setup Wifi using the command line?

I need to setup as following, but its failed:

Target:

Security: WEP
Network name: wifi59/7
Key/password: xyz

Tried and failed:

sudo iwconfig wlan0 mode managed
sudo iwconfig wlan0 channel 11
sudo iwconfig wlan0 essid wifi59/7
sudo iwconfig wlan0 key xyz
Error for wireless request "Set Encode" (8B2A) :
    SET failed on device wlan0 ; Invalid argument.

Best Answer

The WEP key should be in hex, and either 10 or 26 characters long (5 or 13 ASCII bytes).

If you want to specify it in ASCII, you have to prefix it with s: - I'm not sure if iwconfig will pad out an ASCII password, but try lengths of 5 or 13.

See man iwconfig and scroll down to key/enc[ryption] for some examples.

Related Question