how to connect to wifi that has a encryption key, in terminal

1.1k Views Asked by At

I can connect to wifi

sudo ifconfig wlan0 up sudo iwconfig wlan0 essid sudo dhclient wlan0

but I don't know how to connect to encrypted wlan so please tell me how to do that, if a wifi password is "abcdef" Thank you.

1

There are 1 best solutions below

1
IamK On BEST ANSWER

But this is only working with WEP encryption:

sudo iwconfig wlan0 essid name key s:abcdef

sudo dhclient wlan0

WPA

You will need to install wpa-supplicant (sudo apt-get install wpasupplicant)

After you have installed edit the sudo nano /etc/wpa_supplicant.conf

For example:

network={
            ssid="ssid_name"
             psk="abcdef"
}

And finally you can connect with commands:

sudo wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext && sudo dhclient wlan0