LinuxCommandLibrary

wpa_cli

Control and configure WPA supplicant

TLDR

Scan for available networks

$ wpa_cli scan
copy

Show scan results
$ wpa_cli scan_results
copy

Add a network
$ wpa_cli add_network [number]
copy

Set a network's SSID
$ wpa_cli set_network [number] ssid "[SSID]"
copy

Enable network
$ wpa_cli enable_network [number]
copy

Save config
$ wpa_cli save_config
copy

SYNOPSIS

wpa_cli [-i ifname] [-p path] [-a action_file] [-g group] [-s] [-dd] [-ddd] [command]

PARAMETERS

-i ifname
    Specify the interface to use. If not specified, `wpa_cli` will try to use the first available interface.

-p path
    Specify the path to the control interface directory. Defaults to `/var/run/wpa_supplicant`.

-a action_file
    Run the specified action file. The action file contains commands to be executed in sequence.

-g group
    Specify the group name for the control interface. Defaults to `wpa_cli`.

-s
    Show all messages (including debug messages).

-dd
    Increase debugging verbosity.

-ddd
    Maximum debugging verbosity.

[command]
    The command to execute. If no command is specified, `wpa_cli` enters interactive mode.

DESCRIPTION

The `wpa_cli` command is a command-line interface for interacting with `wpa_supplicant`, a software application that implements WPA/WPA2/WPA3 for wireless network authentication. It allows users to control and monitor the behavior of `wpa_supplicant`, enabling tasks such as scanning for available networks, adding and managing network configurations, connecting to networks, monitoring connection status, and retrieving network information. It's a crucial tool for managing wireless network connections, especially in environments where a graphical user interface is not available or where automated scripting is required. `wpa_cli` uses a control interface to communicate with a running `wpa_supplicant` process. This enables to query information, trigger actions, and monitor events. The command is commonly used by system administrators, developers, and advanced users for troubleshooting and configuring wireless connections.

CAVEATS

Ensure `wpa_supplicant` is running before using `wpa_cli`. Permissions may be required to access the control interface. The availability of certain commands depends on the version of `wpa_supplicant` and its configuration.

INTERACTIVE MODE

When run without any command arguments, `wpa_cli` enters interactive mode. In this mode, you can type commands directly and receive immediate feedback from `wpa_supplicant`. This is useful for exploring the available commands and manually configuring wireless networks.

COMMON COMMANDS

Some frequently used `wpa_cli` commands include: scan (to scan for available networks), add_network (to create a new network configuration), set_network (to configure network parameters like SSID and password), enable_network (to enable a network for connection), select_network (to select a specific network to connect to), and disconnect (to disconnect from the current network).

HISTORY

The `wpa_cli` command was developed as part of the `wpa_supplicant` project, which aims to provide a secure and robust implementation of WPA/WPA2/WPA3 protocols. It provides a way to interact with `wpa_supplicant` without a graphical interface, making it crucial for embedded systems, servers, and automated network configuration. The command's development has closely followed the evolution of wireless security standards, with updates to support new protocols and features.

SEE ALSO

Copied to clipboard