Reference: Configuring a NetworkManager Wireless Connection without Graphics

Say, hypothetically, that you install a new Linux distribution and your machine locks up whenever you try to log in graphically. You might want to set up a wireless connection to see if there are system updates available that might fix the problem. If your system uses NetworkManager, it might not be clear how to accomplish this.

The NM SystemSettings page and settings specification document are useful references, but don’t pull the full answer together. You want to create a file in /etc/NetworkManager/system-connections/, named whatever you like. It should be owner root:root and mode 600. The contents should look like:

[connection]
id=Argh
uuid=11111111-1111-1111-1111-111111111111
type=802-11-wireless
timestamp=0

[802-11-wireless]
ssid=SEE BELOW
mode=infrastructure
security=802-11-wireless-security

[802-11-wireless-security]
key-mgmt=wpa-psk
psk=YOUR-NETWORKS-PASSWORD-IN-PLAINTEXT

[ipv4]
method=auto

Obviously this only works for WPA/PSK mode, but I think that’s by far the most common for encrypted WiFi networks these days.

The SSID is specified as a byte string. If your SSID is expressible in ASCII you can generate this with a Python snippet like:

';'.join(str(ord(c)) for c in 'SSID')+';'

For instance, the network ‘Sample’ is expressed as 83;97;109;112;108;101;. No quotation marks are used in the config file.

NetworkManager appears to monitor the system-connections directory, and may initially reject your file if it doesn’t have the restrictive permissions it wants. Editing the file after the permissions have been changed causes that to be reloaded. The command nmcli con up id Argh should activate the connection.

Questions or comments? For better or worse this website isn’t interactive, so send me an email or, uh, Toot me.

To get notified of new posts, try subscribing to my lightweight newsletter or my RSS/Atom feed. No thirsty influencering — you get alerts about what I’m writing; I get warm fuzzies from knowing that someone’s reading!

Later: Reference: LaTeX, hyperref, and “Command \url already defined.”

Earlier: Reference: What to Do If Fedora 15 Locks Up on Login

See a list of all posts.

View the revision history of this page.