$linuxjunkies
>

hostapd(8)

hostapd is a user-space daemon for access point and authentication server management on Linux.

UbuntuDebianFedoraArch

Synopsis

hostapd [-h] [-d | -dd | -ddd | -dddd] [-P <pid_file>] [-B] [-e <entropy_file>] [-g <global_ctrl_iface>] [-G <group>] [-K] [-T] [-v] <configuration_file> [<configuration_file2> ...]

Description

hostapd is a daemon that enables a Linux system with suitable wireless hardware to act as an IEEE 802.11 access point (AP) and authentication server. It implements the IEEE 802.1X/WPA/WPA2/WPA3 protocols for authenticating wireless clients, managing encryption keys, and controlling access to the wireless network.

hostapd reads a configuration file that specifies wireless interface settings, SSID, security parameters, and authentication methods. It communicates with the Linux kernel driver via the nl80211 (netlink) interface and manages the wireless hardware to broadcast the access point and handle client connections.

The daemon is commonly used in enterprise WiFi deployments, network testing environments, and on embedded systems like Raspberry Pi to create software-based wireless access points.

Common options

FlagWhat it does
-dShow debug messages (increased verbosity with additional d's: -dd, -ddd, -dddd)
-BDaemonize after startup (run in background)
-PWrite PID to specified file for tracking the daemon process
-gSpecify global control interface socket directory (default: /var/run/hostapd)
-GSet group ownership for control interface sockets
-eRead entropy from file to seed random number generator
-hDisplay usage information and exit
-vShow version information
-KInclude key dump in debug output (requires -d and compile-time support)
-TLog output to syslog instead of stdout

Examples

Start hostapd with the default configuration file in foreground with debug output

hostapd /etc/hostapd/hostapd.conf

Start hostapd as a daemon in the background and write its PID to a file

hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf

Start hostapd with verbose debug output showing detailed information about operations

hostapd -dd /etc/hostapd/hostapd.conf

Start hostapd managing multiple wireless interfaces with separate configuration files

hostapd /etc/hostapd/wlan0.conf /etc/hostapd/wlan1.conf

Start hostapd with custom control interface socket directory for hostapd_cli connections

hostapd -d -g /tmp/hostapd_ctrl /etc/hostapd/hostapd.conf

Start hostapd in background and verify it's running using hostapd_cli

hostapd -B /etc/hostapd/hostapd.conf && hostapd_cli -p /var/run/hostapd ping

Related commands