You are not logged in.

#1 2011-08-14 04:11:22

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

How to connect to an encrypted wireless network with wpa_supplicant?

With wpa_supplicant and ifplugd properly configured, a computer will autoconnect to the strongest open wireless network. That's all well and good.. But sometimes you want to connect to a specific network - usually an encrypted one.

How can I do that with wpa_supplicant and wpa_cli, without having to edit wpa_supplicant.conf for every specific network I want to connect to? i.e. what commands would I use in wpa_cli to set the authentication type and key for a network with a given SSID, and then force association with it? I've looked at the man pages and the built-in help, but I seem to be missing something.

Also, on a related topic: is there any kind of shorthand for referring to networks in wpa_cli, so I don't have to type out the whole SSID?

Offline

#2 2011-08-14 07:02:59

SlayingDragons
Member
Registered: 2011-07-12
Posts: 42

Re: How to connect to an encrypted wireless network with wpa_supplicant?

Hmm... If I'm correct, the configuration file for wpa_supplicant doesn't have to be named "wpa_supplicant.conf," so you could have a different conf file set up for each network, and then be lazy like me and manage them with a script, like this:

#!/bin/sh

if [ "$@" = "-a" ]
then
	sudo wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_conf1.conf
	echo "wpa configuration 1 loaded."
elif [ "$@" = "-b" ]
then
	sudo wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_conf2.conf
	echo "wpa configuration 2 loaded."
else
	echo "Hmm... No configuration for that."
fi
exit 0

#Of course edit this as needed.

Then you could just type in "sh script_name.sh -a" into a terminal to start your first configuration. If you're also as lazy as me, you can set an alias in your .bashrc to execute the script like "alias wpa_start='sh ~/script_name.sh'" so you can just do "wpa_start -a".

Also, did you check the wiki here? It's a godsend, I tell ya. wink

I also don't know of any type of shorthand, sorry.


Sorry if this is too patronizing, I want to be detailed as this is the newbie corner, and it's better to give a bit too much than to not give enough. >_>

Last edited by SlayingDragons (2011-08-14 07:10:59)

Offline

#3 2011-08-14 14:17:11

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: How to connect to an encrypted wireless network with wpa_supplicant?

Thanks, but I'm talking about once-off connections to encrypted networks, e.g. at a hotel or somesuch. Surely that can be done without editing or creating any new files?

As for the wiki, it annoyingly does not say anything about how to use wpa_cli. It does tell you how to use wpa_gui (which is easy enough), but what if you want to connect from the command line?

Offline

#4 2011-08-14 14:40:31

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: How to connect to an encrypted wireless network with wpa_supplicant?

Gullible Jones wrote:

As for the wiki, it annoyingly does not say anything about how to use wpa_cli. It does tell you how to use wpa_gui (which is easy enough), but what if you want to connect from the command line?

I haven't wpa_supplicant installed, but there should be a man page like this one.


To know or not to know ...
... the questions remain forever.

Offline

#5 2011-08-14 15:21:21

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: How to connect to an encrypted wireless network with wpa_supplicant?

Oh... Duh. Somehow I missed this:

Example request for password and a matching reply:

    CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
    > password 1 mysecretpassword

Example request for generic token card challenge-response:

    CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
    > otp 2 9876

But this still doesn't answer how I force association with a specific network. Also, is there any way to get wpa_cli to repeat a request like that?

Offline

#6 2011-08-14 15:27:53

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: How to connect to an encrypted wireless network with wpa_supplicant?

Gullible Jones wrote:

Thanks, but I'm talking about once-off connections to encrypted networks, e.g. at a hotel or somesuch. Surely that can be done without editing or creating any new files?

As for the wiki, it annoyingly does not say anything about how to use wpa_cli. It does tell you how to use wpa_gui (which is easy enough), but what if you want to connect from the command line?

networkmanager with frontend. (or wicd)

Last edited by Mr.Elendig (2011-08-14 15:28:22)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#7 2011-08-16 00:37:23

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: How to connect to an encrypted wireless network with wpa_supplicant?

IOW, no way of doing it.

Drat.

I figured that it would at least be possible, if not exactly easy... Oh well.

Offline

#8 2011-08-16 00:53:48

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: How to connect to an encrypted wireless network with wpa_supplicant?

wifi-select is probably the nicest way of handling this. Or, if you're using openbox, wifi-pipe.

Offline

Board footer

Powered by FluxBB