create-hotspot.sh
· 611 B · Bash
原始檔案
#!/bin/bash
echo 'Original post : https://unix.stackexchange.com/a/310699'
nmcli con add type wifi ifname wlan0 con-name Hostspot autoconnect no 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 conn modify Hostspot wifi-sec.psk "veryveryhardpassword1234"
nmcli con up Hostspot
# Note after reboot `nmcli con up Hotspot` doesn't work
# Use this command instead
#-------------------------
# UUID=#(grep uuid /etc/NetworkManager/system-connections/Hotspot | cut -d= -f2)
# nmcli con up uuid $UUID
| 1 | #!/bin/bash |
| 2 | echo 'Original post : https://unix.stackexchange.com/a/310699' |
| 3 | |
| 4 | nmcli con add type wifi ifname wlan0 con-name Hostspot autoconnect no ssid Hostspot |
| 5 | nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared |
| 6 | nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk |
| 7 | nmcli conn modify Hostspot wifi-sec.psk "veryveryhardpassword1234" |
| 8 | nmcli con up Hostspot |
| 9 | |
| 10 | # Note after reboot `nmcli con up Hotspot` doesn't work |
| 11 | # Use this command instead |
| 12 | #------------------------- |
| 13 | # UUID=#(grep uuid /etc/NetworkManager/system-connections/Hotspot | cut -d= -f2) |
| 14 | # nmcli con up uuid $UUID |