A simple bash
script to share your computer's WiFi connection settings
via QR code.
Requires the command-line utility
nmcli
from NetworkManager—plus
qrencode
and
ImageMagick's display
in order to actually
display the barcode.
$ curl https://raw.githubusercontent.com/dlenski/wifi2qr/HEAD/wifi2qr > ~/bin/wifi2qr
$ chmod x !$
$ wifi2qr
… which will display a barcode that you can read with your smartphone to connect to the
network. Tested with Android's zxing
-based
Barcode Scanner,
the somewhat more modern
QR & Barcode Scanner,
and the iPhone Camera app.
You can also share a specific connection, by its NetworkManager
connection name or UUID with wifi2qr CONNECTION
.
You can list known WiFi connections with wifi2qr -l
.
Note: only zxing
-based apps appear to support the E/A/I/PH2
fields which are needed to configure WPA-EAP ("Enterprise") WiFi
networks;
those fields are not present in the official-ish
WPA3 specification
for WiFi URIs.
wifi2qr [-h] [-l] [-u | -a] [connection]
Displays a QR code that can be scanned to connect to a WiFi network
known to NetworkManager.
Options:
connection Show QR code for specific connection (if not
specified, currently-enabled WiFi connection)
-h Show this help message
-l List WiFi connections known to NetworkManager
-a | -i Show QR code using ANSI characters or with ImageMagick
| -o FILE or save to a file (e.g. qrcode.png)
(default is to show using UTF8 characters)
-q Quiet mode (default is to print barcode in text
form to stderr as well; this suppresses it)