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:





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.