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.confThis 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 link3. 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-Bruns it in the background.-ispecifies the interface.-cpoints 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.techIf 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
~/.profileor~/.bashrc. - For graphical logins via
~/.xinitrc, append the command with an&(background) at the end.