1) From the non-interactive mode , you can scan and list the available access points :
iwctl station wlp8s0 scan
iwctl station wlp8s0 get-networks
The wifi credentials are stored under /var/lib/iwd
, the exact name of the SSID should be used , the format:
SSID.psk
The content:
[Security]
PreSharedKey=encripted-password
Passphrase=the-plain-txt-password
The minimal configuration file should contain the encrypted wifi paswword (PreSharedKey)
To generate an encrypted psk , you can use the wpa_passhrase tool:
wpa_passhrase "My-SSID" passphrase
There is an example using "My SSID" and mysecretpassword
:
$ cat My\ SSID.psk
[Security]
PreSharedKey=8e1e64a6ecaf2b5e0aa29816547af300d7f3b0473bbfa56ddb5514ad4683804c
2) To connect from the terminal:
iwctl station <INTERFACE> connect "SSID"
e,g:
iwctl station wlp8s0 connect "My SSID"
dhclient
dhclient
can be replaced an iproute2 command to assign an IP address to wlp8s0.
3) to automatically enable the wifi connection at boot , there is a way using a systemd service:
A minimal script to connect:
$ cat /usr/local/enable-wifi.sh
#!/bin/bash
iwctl station wlan0 connect "My SSID"
dhclient
Create a systemd service.
$ cat /etc/systemd/system/enable-wifi.service
[Unit]
Before=network.target
Wants=network.target
[Service]
ExecStart=/usr/local/enable-wifi.sh
[Install]
WantedBy=default.target
then :
# chmod 744 /usr/local/enable-wifi.sh
# chmod 664 /etc/systemd/system/enable-wifi.service
# systemctl daemon-reload
# systemctl enable enable-wifi.service
documentation:
arch-linux wiki : iwd
Debian wiki: NetworkManager/iwd
lwn: iwd: simplifying WiFi management