Skip to content

Instantly share code, notes, and snippets.

@narate
Last active July 30, 2025 22:23
Show Gist options
  • Save narate/d3f001c97e1c981a59f94cd76f041140 to your computer and use it in GitHub Desktop.
Save narate/d3f001c97e1c981a59f94cd76f041140 to your computer and use it in GitHub Desktop.
Create Wi-Fi Hotspot on Linux using nmcli

Create a Wi-Fi hotspot on Linux using nmcli

Original post : https://unix.stackexchange.com/a/310699

nmcli con add type wifi ifname wlan0 con-name Hostspot autoconnect yes ssid Hostspot
nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk
nmcli con modify Hostspot wifi-sec.psk "veryveryhardpassword1234"
nmcli con up Hostspot

Note

If after reboot nmcli con up Hotspot doesn't work

Use this command instead to start Hotspot

UUID=$(grep uuid /etc/NetworkManager/system-connections/Hotspot | cut -d= -f2)
nmcli con up uuid $UUID
@jacobq
Copy link

jacobq commented Oct 3, 2024

Correct me if I'm wrong, but I think adding the following uses WPA2:

nmcli con modify Hostspot wifi-sec.group ccmp
nmcli con modify Hostspot wifi-sec.pairwise ccmp

and for WPA3 maybe something like this:

nmcli con modify Hostspot wifi-sec.key-mgmt sae

(Note: intentional misspelling of hotspot as Hostspot to match OP)

@ConzZah
Copy link

ConzZah commented Mar 16, 2025

for those who can create their hotspot but don't have internet through it:
symlink iptables to /sbin/iptables
and it should work.

@Ingenium-LiDAR
Copy link

Whenever I try the first line, I get
Error: Failed to add 'Hostspot' connection: failure adding connection: keyfile writer produces an invalid connection: cannot access file: No such file or directory
I'm on Ubuntu Core. Any help would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment