Connect to WPA2 wireless network through command line
You can also be interested in:
There is one rule I learned during my linux experience: If you want to learn things, you've to break things.
Trying to solve problems alone is the best way to increase your linux knowledge.
That said, almost every disaster can be recovered through your command line, so when X crashes, when you have broken your windows manager or display manager, you'll always be able to recover from terminal, BUT you need at least one thing: one active internet connection.
If you can go with a LAN cable ok, there is hopefully no problem, but what if only a WPA protected wlan network is available for you?
Clearly you've to connect to such network through command line in order to use your apt-get or yum or emerge or xxxx commands, so these are the steps you may follow (tested on ubuntu):
-
Stop the network manager to free the wlan0 interface
$ sudo /etc/init.d/networkmanager stop
-
Scan for available wireless networks in order to get the right ESSID
$ sudo iwlist scanning
such command returns a list of available wireless networks with many information and in particular the ESSID of each network
-
Make a config for wpa_supplicant and run it
$ sudo wpa_passphrase "ESSID" "PASSWORD" > wpaconfig
$ sudo wpa_supplicant -iwlan0 -cwpaconfigWhere ESSID and PASSWORD have to be replaced with the network ESSID taken at the step 2 and the network password
-
Digit [ctrl-z] to run wpa_supplicant in the background
-
Get assigned an IP
$ sudo dhclient wlan0
-
Test your internet connection
$ ping www.google.com
And now you can recover your system!
Your Smartwatch Loves Tasker!
Your Smartwatch Loves Tasker!
Featured
Archive
- 2021
- 2020
- 2019
- 2018
- 2017
- Nov
- Oct
- Aug
- Jun
- Mar
- Feb
- 2016
- Oct
- Jun
- May
- Apr
- Mar
- Feb
- Jan
- 2015
- Nov
- Oct
- Aug
- Apr
- Mar
- Feb
- Jan
- 2014
- Sep
- Jul
- May
- Apr
- Mar
- Feb
- Jan
- 2013
- Nov
- Oct
- Sep
- Aug
- Jul
- Jun
- May
- Apr
- Mar
- Feb
- Jan
- 2012
- Dec
- Nov
- Oct
- Aug
- Jul
- Jun
- May
- Apr
- Jan
- 2011
- Dec
- Nov
- Oct
- Sep
- Aug
- Jul
- Jun
- May