WPA_CLI(8)
โจ NAME โจ
wpa_cli โ the WPA command line client ๐ซถ (this is page 8 of the manual, so like, sysadmin territory, bestie)
๐ธ SYNOPSIS ๐ธ
wpa_cli [ -p path to ctrl sockets ] [ -g path to global ctrl_interface
socket ] [ -i ifname ] [ -hvB ] [ -a action file ] [ -P pid file ] [ -G
ping interval ] [ command ... ]
๐ OVERVIEW ๐
So wpa_cli is a text-based frontend program that talks to wpa_supplicant. That's the whole vibe. You use it to query current status, change configuration, trigger events, and request interactive user input. Very main character of it, honestly. ๐
Like, it can show you the current authentication status, the selected security mode, dot11 and dot1x MIBs, all of it. And that's not even the half of it โ it can also configure some variables, like EAPOL state machine parameters, and trigger events like reassociation and IEEE 802.1X logoff/logon. Iconic.
wpa_cli also gives you a whole user interface for requesting authentication information, like username and password, when those aren't chilling in the configuration file. Which is lowkey huge, because it means you can implement stuff like one-time-passwords or generic token card authentication, where the auth is based on a challenge-response that uses an external device to generate the response. Fr fr, that's a real use case. ๐
The control interface of wpa_supplicant can be configured to allow non-root user access โ that's the ctrl_interface GROUP= parameter in the configuration file, iykyk โ which means yes, you can absolutely run wpa_cli with a normal user account. No sudo required, bestie. โจ
Now, wpa_cli supports two modes: interactive and command line. Both modes share the exact same command set, the only real difference is that interactive mode gives you access to unsolicited messages (event messages, username/password requests). That's it. That's the tea. ๐
- Interactive mode starts when you run
wpa_cliwithout passing a command as a command line parameter. You then type commands right there at thewpa_cliprompt. - Command line mode is the same commands, except you enter them as command line arguments to
wpa_cli.
๐ INTERACTIVE AUTHENTICATION PARAMETERS REQUEST ๐
Okay so here's the situation. When wpa_supplicant needs authentication parameters โ username, password, that kind of thing โ and they are NOT present in the configuration file, it sends a request message out to all attached frontend programs. So like, wpa_cli in interactive mode is one of those. ๐
wpa_cli shows you these requests with a CTRL-REQ-<type>-<id>:<text> prefix. Let's break that down because the details matter:
<type>is one ofIDENTITY,PASSWORD, orOTP(one-time-password).<id>is a unique identifier for the current network.<text>is a description of the request. And in the case of an OTP request, it includes the challenge from the authentication server. Spicy. ๐ถ๏ธ
You reply to these requests with the identity, password, and otp commands. You need to copy <id> from the matching request โ don't make it up, bestie, it has to match.
password and otp can be used regardless of whether the request was for PASSWORD or OTP. The main difference between the two commands is this:
- values given with
passwordare remembered for as long aswpa_supplicantis running ๐ง - values given with
otpare used only once and then forgotten โ i.e.,wpa_supplicantwill ask the frontend for a brand new value for every single use ๐
And that is what lets you implement one-time-password lists and generic token card-based authentication. Slay.
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
๐ ๏ธ COMMAND ARGUMENTS ๐ ๏ธ
-ppath โ change the path where control sockets should be found.-gcontrol socket path โ connect to the global control socket at the indicated path rather than an interface-specific control socket.-iifname โ specify the interface that is being configured. By default, it picks the first interface found with a control socket in the socket path. (Default behaviour, no cap. ๐)-hโ help. Shows you a usage message.-vโ show version information.-Bโ run as a daemon in the background.-afile โ run in daemon mode, executing the action file based on events fromwpa_supplicant. The specified file gets executed with the first argument set to the interface name and the second set to"CONNECTED"or"DISCONNECTED"depending on the event. This is how you run networking tools that are required to configure the interface. ๐
Also โ and this part is important โ three environmental variables are available to that file: WPA_CTRL_DIR, WPA_ID, and WPA_ID_STR.
WPA_CTRL_DIRcontains the absolute path to thectrl_interfacesocket.WPA_IDcontains the uniquenetwork_ididentifier assigned to the active network.WPA_ID_STRcontains the content of theid_stroption.
-Pfile โ set the location of the PID file.-Gping interval โ set the interval (in seconds) at whichwpa_clipings the supplicant. ๐commandโ run a command. The available commands are listed in the next section. ๐
๐ COMMANDS ๐
The following commands are available:
statusโ get current WPA/EAPOL/EAP statusmibโ get MIB variables (dot1x, dot11)helpโ show this usage helpinterface [ifname]โ show interfaces / select interfacelevel <debug level>โ change debug levellicenseโ show fullwpa_clilicenselogoffโ IEEE 802.1X EAPOL state machine logofflogonโ IEEE 802.1X EAPOL state machine logonsetโ set variables (and it shows you the list of variables when you run it without arguments, cute)pmksaโ show PMKSA cachereassociateโ force reassociationreconfigureโ forcewpa_supplicantto re-read its configuration filepreauthenticate <BSSID>โ force preauthenticationidentity <network id> <identity>โ configure identity for an SSIDpassword <network id> <password>โ configure password for an SSIDpin <network id> <pin>โ configure pin for an SSIDotp <network id> <password>โ configure one-time-password for an SSIDbssid <network id> <BSSID>โ set preferred BSSID for an SSIDlist_networksโ list configured networksterminateโ terminatewpa_supplicantquitโ exitwpa_cli
๐ SEE ALSO ๐
๐ LEGAL ๐
wpa_supplicant is copyright (c) 2003-2022, Jouni Malinen <j@w1.fi> and contributors. All Rights Reserved.
This program is licensed under the BSD license (the one with advertisement clause removed). ๐โจ
And that's the whole page, bestie โ this one landed on 07 August 2019 as part of the wpa_cli(8) manual. Go forth and configure your interfaces. ๐๐ฆ
๐ฆ where this page comes from
- alpine 3.22: wpa_supplicant-doc 2.11-r2 ยท BSD-3-Clause
- alpine 3.23: wpa_supplicant-doc 2.11-r3 ยท BSD-3-Clause
- alpine 3.24: wpa_supplicant-doc 2.11-r4 ยท BSD-3-Clause
- arch rolling: wpa_supplicant 2:2.12-1 ยท BSD-3-Clause
- debian bookworm: wpasupplicant 2:2.10-12+deb12u2 ยท BSD-3-Clause
- debian bookworm: wpasupplicant 2:2.10-12+deb12u3 ยท BSD-3-Clause
- debian trixie: wpasupplicant 2:2.10-24 ยท BSD-3-Clause
- nixos 26.05: wpa_supplicant 2.12
- nixpkgs unstable: wpa_supplicant 2.12
- opensuse-leap 16.0: wpa_supplicant 2.11-160000.5.1 ยท BSD-3-Clause AND GPL-2.0-or-later
- opensuse-leap 16.0: wpa_supplicant 2.11-160000.5.1 ยท BSD-3-Clause AND GPL-2.0-or-later
- opensuse-leap 16.0: wpa_supplicant 2.11-160000.5.1 ยท BSD-3-Clause AND GPL-2.0-or-later
- opensuse-leap 16.0: wpa_supplicant 2.11-160000.5.1 ยท BSD-3-Clause AND GPL-2.0-or-later
- ubuntu jammy: wpasupplicant 2:2.10-6 ยท BSD-3-Clause
- ubuntu jammy: wpasupplicant 2:2.10-6ubuntu2.2 ยท BSD-3-Clause
- ubuntu jammy: wpasupplicant 2:2.10-6ubuntu2.4 ยท BSD-3-Clause
- ubuntu noble: wpasupplicant 2:2.10-21build4 ยท BSD-3-Clause
- ubuntu noble: wpasupplicant 2:2.10-21ubuntu0.2 ยท BSD-3-Clause
- ubuntu noble: wpasupplicant 2:2.10-21ubuntu0.4 ยท BSD-3-Clause
- ubuntu questing: wpasupplicant 2:2.11-0ubuntu4
- ubuntu resolute: wpasupplicant 2:2.11-0ubuntu5 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms