LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices


Reply
  Search this Thread
Old 03-17-2023, 11:09 AM   #1
annn
LQ Newbie
 
Registered: Mar 2023
Posts: 10

Rep: Reputation: 0
Trouble connect to a username and password wifi using wpa_supplicant


I try
wpa_cli
add_network
x
set_network x ssid “myssid”
ok
set_network x identity “myusername”
ok
set_network x psk “mypassword”
ok
enable_network x

doesn’t work

so I try putting in my /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
ssid=“myssid”
identity=“myusername”
psk=“mypassword”
key_mgmt=WPA-EAP
}

wpa_supplicant -B -i wlp62s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
also doesn’t work

not sure what the key_mgmt=WPA-EAP means but I saw others doing it
 
Old 03-17-2023, 01:00 PM   #2
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,521

Rep: Reputation: Disabled
Usually, I think, you just need ssid psk & dhcp.
 
Old 03-17-2023, 01:28 PM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,454

Rep: Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353
Hello, annn, & welcome to LQ.

If you're using networkmanager, let that do the heavy lifting. There's also nm-tui for TextUserInterface. If you're doing this by hand, start with wpa_passphrase if you haven't done so. Use the man page to get from your wifi password to psk conversion. First time, I was caught by that. Put all that in your wpa_supplicant.conf.

You can put several protocols in wpa-supplicant.conf. I use WPA-PSK, and that works.

You command looks reasonable. Take out the '-B' and you get it logging to the terminal. Put that back in once you're happy. You also need to add '-D nl80211' at the front to give it a kernel driver.

When you're entering this from a terminal, you can do the connection on one line by adding ' && sudo dhcpcd -w wlp62s0' Then both programs should connect with output, then fork to the background in turn.
 
Old 03-17-2023, 02:22 PM   #4
yvesjv
Member
 
Registered: Sep 2015
Location: Australia
Distribution: Slackware, Devuan, Freebsd
Posts: 580

Rep: Reputation: Disabled
Smile

With all wireless connectivity, it takes two to tango... sometimes three depending on the deployment, for example dot1x over the wireless. But we will not cover that atm

First, the wireless access point (WAP) which can be a stand-alone device (enterprise/small business) or integrated into your router (common for home setup) has to be configured with the desired protocol(s) and parameters.
Second, the client must support the advertised authentication protocol(s) by the WAP and of course has the latest drivers due to resolved bugs, new features, etc.

If you inform what your WAP is configured with, we can very likely assist.
Also as root or a sudoer, what WNIC you have with this command:
/usr/sbin/lshw -C network

My WAP ssid is configured for and is advertising WPA3-Personal and not WPA-EAP.
I call wpa_supplicant like below where my integrated wireless device is wlan0
1. Bring up wlan0
/sbin/ifconfig wlan0 up

2. Start wpa_supplicant with the wnic
/usr/sbin/wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0

3. Acquire a DHCP address
/sbin/dhclient -4 wlan0 -v

4. View the wnic settings
/sbin/iwconfig wlan0

My file /etc/wpa_supplicant.conf is below but yours should differ based on your WAP configuration towards your broadcasted ssid.
network={
scan_ssid=1
ssid="thisisprivate"
key_mgmt=SAE
sae_password="thisisevenmoreprivate"
ieee80211w=2
}


This works for me as long as wpa_supplicant has all the required supporting binaries and other files. Easy to check with the following commands:
/usr/sbin/wpa_supplicant -v
ldd /usr/sbin/wpa_supplicant

You can also view the options for wpa_supplicant but running this command
man wpa_supplicant

Last edited by yvesjv; 03-17-2023 at 03:05 PM. Reason: more info required
 
Old 03-17-2023, 07:03 PM   #5
annn
LQ Newbie
 
Registered: Mar 2023
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by business_kid View Post
Hello, annn, & welcome to LQ.

If you're using networkmanager, let that do the heavy lifting. There's also nm-tui for TextUserInterface. If you're doing this by hand, start with wpa_passphrase if you haven't done so. Use the man page to get from your wifi password to psk conversion. First time, I was caught by that. Put all that in your wpa_supplicant.conf.

You can put several protocols in wpa-supplicant.conf. I use WPA-PSK, and that works.

You command looks reasonable. Take out the '-B' and you get it logging to the terminal. Put that back in once you're happy. You also need to add '-D nl80211' at the front to give it a kernel driver.

When you're entering this from a terminal, you can do the connection on one line by adding ' && sudo dhcpcd -w wlp62s0' Then both programs should connect with output, then fork to the background in turn.
Woah, you’ve been on this forum longer than I’ve been alive.

Anyways, I didn’t know that psk and password are two different things. I’ll look into this. I tried using nmcli earlier but still couldn’t get it working. I’ve never used -D nl80211 and sudo dhcpcd -w wlp62s0 before. Are these parts only necessary when using username/password wifi or should I use them even on normal wifis? My home network always works without me needing using these.

I’m not going to be back at my school with the network issue for 10 days so I wont get to try what you said for 10 days but I’ll write another reply if I can’t get it working then.
 
Old 03-17-2023, 07:19 PM   #6
annn
LQ Newbie
 
Registered: Mar 2023
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by yvesjv View Post
If you inform what your WAP is configured with, we can very likely assist.
I don't know how to find this out but I think it may be [ESS]. I wont be back at my school for 10 days so I won't be able to run a scan but I rememebr that the network appeared different than every other network when I looked at the scan_results and also it said [ESS] and I think this is a flag.

I also know that when I did enable_network x
it returned
CTRL-EVENT-SCAN-RESULTS
CTRL-EVENT-NETWORK-NOT-FOUND

Quote:
Originally Posted by yvesjv View Post
Also as root or a sudoer, what WNIC you have with this command:
/usr/sbin/lshw -C network
*-network
description: Wireless interface
product: Wi-Fi 6 AX200
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:3e:00.0
logical name: wlp62s0
version: 1a
serial: a4:42:3b:8e:28:bc
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=6.1.15_1 firmware=72.daa05125.0 cc-a0-72.ucode ip=192.168.68.61 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:19 memory:b8400000-b8403fff

Not sure which one of these lines has the information you need
 
Old 03-17-2023, 07:51 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Quote:
not sure what the key_mgmt=WPA-EAP means but I saw others doing it
The EAP in WPA-EAP is Extensible Authentication ProtocoL. Basically it requires additional authentication which provides additional security and auditing by requiring a username and password to be able to login to the network. As posted 801.x requires additional settings from the typical home wireless network.

Did the school provide any information on how to connect to their wireless network? If so did they provide any additional information besides the username and password? There are several different types of authentication methods and without knowing the details it isn't possible to post exactly how to setup the configuration file. You might have to ask their IT department for help.

While it isn't necessarily important what linux distribution / version is your device running?

I did not see your latest post but Wi-Fi 6 AX200 requires a fairly newer kernel.

Last edited by michaelk; 03-17-2023 at 07:56 PM.
 
Old 03-17-2023, 09:15 PM   #8
yvesjv
Member
 
Registered: Sep 2015
Location: Australia
Distribution: Slackware, Devuan, Freebsd
Posts: 580

Rep: Reputation: Disabled
Thumbs up

As Michaelk pointed to, you will require more assistance/information before going further with configuring your wpa_supplicant.conf file and making use of it.

This link provides a good read on what ESS is: https://en.wikipedia.org/wiki/Servic...802.11_network)

Towards my clients on the enterprise network, I use the NetworkManager gui on their laptops to configure their wireless. Much easier for the clients and you could consider when back at school?

Usually when using the wpa-cli command you will see the below
wlan0 is my wireless nic.
And if you require more assistance, please provide the requested information.
wpa-cli -i wlan0
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-RESULTS
<3>WPS-AP-AVAILABLE
<3>CTRL-EVENT-NETWORK-NOT-FOUND


I don't usually wait much after seeing <3>CTRL-EVENT-SCAN-STARTED and I then run the command below
scan_results
This will then show something similar to this example below
bssid / frequency / signal level / flags / ssid
7c:26:64:0c:21:24 2472 -82 [WPA2-PSK-CCMP][WPS][ESS] BelongXETRRQGP
48:d2:4f:32:2d:3a 2412 -86 [WPA2-PSK-CCMP][WPS][ESS] Belong322D34
a4:91:b1:2c:2d:7f 2462 -92 [WPA2-PSK-CCMP][WPS][ESS] Telstra2C2D7F


Nothing wrong with asking your IT administrators at school for assistance, in most cases they would be keen to assist a client.
But If you require further assistance, please provide the requested information.

Last edited by yvesjv; 03-17-2023 at 09:18 PM.
 
Old 03-18-2023, 05:49 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,454

Rep: Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353
Quote:
Originally Posted by annn View Post
Woah, you’ve been on this forum longer than I’ve been alive.

Anyways, I didn’t know that psk and password are two different things. I’ll look into this. I tried using nmcli earlier but still couldn’t get it working. I’ve never used -D nl80211 and sudo dhcpcd -w wlp62s0 before. Are these parts only necessary when using username/password wifi or should I use them even on normal wifis? My home network always works without me needing using these.

I’m not going to be back at my school with the network issue for 10 days so I wont get to try what you said for 10 days but I’ll write another reply if I can’t get it working then.
If your 'home network always works' you're using networkmanager. There's 2 ways of doing this
  1. Use networkmanager, usually in X.
  2. Use init scripts, where you need wpa_supplicant.
When you see instructions for one set, they usually forget the other way exists. I use the scripts on Slackware, but Debian has systemd & networkmanager. And yes I'm old. The Governmemnt here used to pay me for being decrepit (Disability Allowance), but now it pays me for being ancient, and the fringe benefits are better . And you're probably at the stage when you're not quite ready to pay your own way while you still know everything . Enjoy it - you'll be old before you know it .
 
Old 03-18-2023, 08:33 AM   #10
annn
LQ Newbie
 
Registered: Mar 2023
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by michaelk View Post
The EAP in WPA-EAP is Extensible Authentication ProtocoL. Basically it requires additional authentication which provides additional security and auditing by requiring a username and password to be able to login to the network. As posted 801.x requires additional settings from the typical home wireless network.

Did the school provide any information on how to connect to their wireless network? If so did they provide any additional information besides the username and password? There are several different types of authentication methods and without knowing the details it isn't possible to post exactly how to setup the configuration file. You might have to ask their IT department for help.

While it isn't necessarily important what linux distribution / version is your device running?

I did not see your latest post but Wi-Fi 6 AX200 requires a fairly newer kernel.


No, they haven't provided any information besides how to connect to it on windows and mac which is just: click the wifi icon then click connect on their network and open a browser then you will be prompted for usernamend password.

Running void linux with kernel 6.1.15_1
 
Old 03-18-2023, 08:44 AM   #11
annn
LQ Newbie
 
Registered: Mar 2023
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by yvesjv View Post
As Michaelk pointed to, you will require more assistance/information before going further with configuring your wpa_supplicant.conf file and making use of it.

This link provides a good read on what ESS is: https://en.wikipedia.org/wiki/Servic...802.11_network)

Towards my clients on the enterprise network, I use the NetworkManager gui on their laptops to configure their wireless. Much easier for the clients and you could consider when back at school?

Usually when using the wpa-cli command you will see the below
wlan0 is my wireless nic.
And if you require more assistance, please provide the requested information.
wpa-cli -i wlan0
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-RESULTS
<3>WPS-AP-AVAILABLE
<3>CTRL-EVENT-NETWORK-NOT-FOUND


I don't usually wait much after seeing <3>CTRL-EVENT-SCAN-STARTED and I then run the command below
scan_results
This will then show something similar to this example below
bssid / frequency / signal level / flags / ssid
7c:26:64:0c:21:24 2472 -82 [WPA2-PSK-CCMP][WPS][ESS] BelongXETRRQGP
48:d2:4f:32:2d:3a 2412 -86 [WPA2-PSK-CCMP][WPS][ESS] Belong322D34
a4:91:b1:2c:2d:7f 2462 -92 [WPA2-PSK-CCMP][WPS][ESS] Telstra2C2D7F


Nothing wrong with asking your IT administrators at school for assistance, in most cases they would be keen to assist a client.
But If you require further assistance, please provide the requested information.
Yeah I'm sure I could get it to work using the network manager gui, but I didn't want to install network manager just for one specific network. I'll attempt to get additional information.
 
Old 03-18-2023, 08:47 AM   #12
annn
LQ Newbie
 
Registered: Mar 2023
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by business_kid View Post
If your 'home network always works' you're using networkmanager. There's 2 ways of doing this
  1. Use networkmanager, usually in X.
  2. Use init scripts, where you need wpa_supplicant.
When you see instructions for one set, they usually forget the other way exists. I use the scripts on Slackware, but Debian has systemd & networkmanager. And yes I'm old. The Governmemnt here used to pay me for being decrepit (Disability Allowance), but now it pays me for being ancient, and the fringe benefits are better . And you're probably at the stage when you're not quite ready to pay your own way while you still know everything . Enjoy it - you'll be old before you know it .
I've never had networkmanager installed untill now, so is it really possible for me to be using networkmanager even without it installed?

I'll enjoy my youth while it still lasts
 
Old 03-18-2023, 09:10 AM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Quote:
No, they haven't provided any information besides how to connect to it on windows and mac which is just: click the wifi icon then click connect on their network and open a browser then you will be prompted for username and password.
At first glance that appears to be an open network with a captive portal. The following might work, once you are connected to the WAP then as instructed open a browser. If you are not automatically directed to the proper login page just try using any URL and hopefully it will be redirected. If that does not work hopefully you can find someone in the IT department. Good luck.

Quote:
ssid=“myssid”
key_mgmt=NONE
 
Old 03-18-2023, 12:23 PM   #14
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,454

Rep: Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353
Quote:
Originally Posted by annn
I've never had networkmanager installed untill now, so is it really possible for me to be using networkmanager even without it installed?
Look, there's plenty of guys hot on Debian here. You'll get sorted quicker by them than me.
 
Old 03-18-2023, 02:55 PM   #15
yvesjv
Member
 
Registered: Sep 2015
Location: Australia
Distribution: Slackware, Devuan, Freebsd
Posts: 580

Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by annn View Post
No, they haven't provided any information besides how to connect to it on windows and mac which is just: click the wifi icon then click connect on their network and open a browser then you will be prompted for usernamend password.

Running void linux with kernel 6.1.15_1
Nice choice of a distro.

The captive portal is used for it provides ability to log/allow a specific userID that has acquired an IP address to access services/internet/etc.
We use the captive portal in our environment for visitors, guests and sometimes staff too.
Once they are on the wireless ssid, open firefox (or similar) which has 'Captive portal detection' and you are redirected/prompted for your userID/password combination.

It's probable your school IT administrators have dot1x enabled for all staff, students and clients
Check with them.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure wpa_supplicant configuration to handle multiple USB WIiFi devices with single wpa_supplicant configuration file with system chetuneve Linux - Wireless Networking 1 11-18-2020 04:07 PM
Slackware (PORTEUS) - can't connect to WIFI network via wpa_supplicant glestwid Linux - Newbie 2 10-27-2018 09:51 AM
Can't connect to WPA2 using wpa_supplicant or wifi-menu ternaldius Arch 7 01-02-2017 01:27 PM
wpa_supplicant username and password in clear text AstroFloyd Linux - Security 2 08-03-2015 03:01 AM
wpa_supplicant username and password in clear text roygbiiv Linux - Security 1 07-19-2011 05:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking

All times are GMT -5. The time now is 10:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration