A simple, CLI-only guide for connecting to WPA/WPA2 Wi‑Fi on Linux using wpa_supplicant and runit—ideal for minimal installs without NetworkManager.
1. Create a WPA Passphrase Configuration
Generate the necessary WPA credentials and append them to /etc/wpa_supplicant/wpa_supplicant.conf
:
sudo wpa_passphrase "YOUR_SSID" "YOUR_WIFI_PASSWORD" \
| sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf
This ensures your SSID and password are securely hashed in the config.
2. Identify Your Wi‑Fi Interface
Use ip link
to find the wireless interface name (e.g. wlan0
, wlp3s0
, etc.):
ip link
3. Launch wpa_supplicant
Replace wlan0
with your detected interface name and run:
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
-B
runs it in the background.-i
specifies the interface.-c
points to your configuration file.
4. Enable The Service Through runit
Make the Wi‑Fi configuration automatic on startup by linking the service into runit
directory:
sudo ln -s /etc/sv/wpa_supplicant /var/service/
5. Test The Connection
Check connectivity by pinging a reliable host:
ping noxz.tech
If packets succeed, you’re online!
6. Optional: Auto-Start On Login (Per-User)
To avoid manually starting wpa_supplicant
each session, add this line to your shell profile:
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
- Add to
~/.profile
or~/.bashrc
. - For graphical logins via
~/.xinitrc
, append the command with an&
(background) at the end.