Minimal TUI Wi-Fi Manager: Difference between revisions

From Run Your Own
Jump to navigation Jump to search
Line 15: Line 15:
* don't connect to a Wi-Fi hotspot unless I explicitly ask the COMPUTAR to do so
* don't connect to a Wi-Fi hotspot unless I explicitly ask the COMPUTAR to do so
* if I need to connect to a Wi-Fi hotspot, the COMPUTAR should give me a list of the visible ones
* if I need to connect to a Wi-Fi hotspot, the COMPUTAR should give me a list of the visible ones
* a user-friendly™ interface with fuzzy search should help me tell the COMPUTER which hotspot I want to connect to
* a user-friendly™ interface with fuzzy search should help me tell the COMPUTAR which hotspot I want to connect to
* if the Wi-Fi hotspot is already known, connect to it
* if the Wi-Fi hotspot is already known, the COMPUTAR shall connect to it
* if the Wi-Fi hotspot is unknown, ask for the password, save it, and connect to it
* if the Wi-Fi hotspot is unknown, the COMPUTAR shall ask for the password, save it, and connect to the hotspot


'''Note:''' if the Wi-Fi hotspot needs to be configured with specific settings (for instance for specific key management settings of for open networks), it is necessary to edit <code>wpa_supplicant.conf</code> manually. The rationale is that I need this so rarely needed, that quickly editing a file with obscure settings outweighs by far the need to make a more complicated shell script to handle such corner case :)
'''Note:''' if the Wi-Fi hotspot needs to be configured with specific settings (for instance for specific key management settings of for open networks), it is necessary to edit <code>wpa_supplicant.conf</code> manually. The rationale is that I need this so rarely needed, that quickly editing a file with obscure settings outweighs by far the need to make a more complicated shell script to handle such corner case :)

Revision as of 16:51, 16 June 2024

Good news! If you don't want to install third party daemons, gooey GUI things, or bloat just so you can connect to a wireless access point, then don't worry, Linux has all the CLI tools necessary to create a minimal on-demand TUI shell script thing to connect to, and manage these very Wi-Fi connections. The following info is for Debian, however the approach will be the same for other distros, including BSD operating systems that will differ mostly for some of the network commands.

How does it work?

The things that mater

  • /etc/network/interfaces — network interface configuration for ifup and ifdown
  • iw — show/manipulate wireless devices and their configuration
  • wpa_cli — WPA command line client
  • wpa_supplicant and wpa_supplicant.conf — Wi-Fi Protected Access client and IEEE 802.1X supplicant and its configuration file
  • fzf — command line fuzzy finder

Use case

The use case here is as follow:

  • don't connect to a Wi-Fi hotspot unless I explicitly ask the COMPUTAR to do so
  • if I need to connect to a Wi-Fi hotspot, the COMPUTAR should give me a list of the visible ones
  • a user-friendly™ interface with fuzzy search should help me tell the COMPUTAR which hotspot I want to connect to
  • if the Wi-Fi hotspot is already known, the COMPUTAR shall connect to it
  • if the Wi-Fi hotspot is unknown, the COMPUTAR shall ask for the password, save it, and connect to the hotspot

Note: if the Wi-Fi hotspot needs to be configured with specific settings (for instance for specific key management settings of for open networks), it is necessary to edit wpa_supplicant.conf manually. The rationale is that I need this so rarely needed, that quickly editing a file with obscure settings outweighs by far the need to make a more complicated shell script to handle such corner case :)

Config and script

/etc/network/interfaces

Edit /etc/network/interfaces and adjust to your network name (here wlp2s0).

auto wlp2s0
iface wlp2s0 inet manual
  wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

/etc/network/interfaces

tweaks