Edit a NetworkManager Profile Safely with nmtui-edit
Reach for nmtui-edit when a saved connection needs one field changed and you want a text-mode editor rather than fighting a GUI dialog. You will finish with that profile inspected, edited if needed, and a recovery path in place before you touch anything.
The route
Jump straight to the step you need, or tick off Done means at the end.
- Time: about ten minutes for a small edit, plus time to test the connection afterwards.
- You need: a terminal, NetworkManager, and the profile's name or ID.
- Version: this guide uses the
nmtui-editbinary from NetworkManager 1.46.0, packaged as network-manager 1.46.0-1ubuntu2.8. The interface is curses-based, so use a real terminal rather than a runner that cannot handle interactive screens.
Safety boundary
Editing a profile changes saved network configuration. A wrong address, route, DNS server or wireless setting can cut off access. Keep an existing SSH session open, record the old values, and do not save a change you cannot explain. Most reads below are ordinary commands; reach for sudo only if the system refuses to read or save the profile, not as the first response to an uncertain setting.
1. Confirm the installed command
Check the binary and its built-in help. Neither alters NetworkManager:
$ command -v nmtui-edit
/usr/bin/nmtui-edit
$ nmtui-edit --help
Usage:
nmtui-edit [OPTION...]
Help Options:
-h, --help Show help options
The separate nmtui-edit program skips nmtui's activity-selection screen; the installed manual documents the equivalent form nmtui edit NAME_OR_ID. This build has no documented version flag, so use the package query instead:
$ dpkg-query -W -f='${Package} ${Version}\n' network-manager
network-manager 1.46.0-1ubuntu2.8
Checkpoint
Stop here if command -v finds a different binary from the one you meant to use, or the package is missing.
2. Identify the profile before opening it
Use NetworkManager's read-only listing to get the exact connection name and UUID. A name is convenient; a UUID avoids ambiguity when similar profiles exist:
$ nmcli -f NAME,UUID,TYPE,DEVICE connection show
NAME UUID TYPE DEVICE
Office wired 11111111-2222-3333-4444-555555555555 ethernet enp1s0
Backup Wi-Fi 66666666-7777-8888-9999-aaaaaaaaaaaa wifi --
Your output will differ. Replace PROFILE_ID below with the full name or UUID of the profile you mean to edit, quoting any name with spaces. If you are unsure which one is active, check the DEVICE column rather than guessing from a shortened name:
$ PROFILE_ID='Office wired'
$ nmcli -f NAME,UUID,TYPE,DEVICE connection show "$PROFILE_ID"
NAME UUID TYPE DEVICE
Office wired 11111111-2222-3333-4444-555555555555 ethernet enp1s0
A UUID works equally well:
$ PROFILE_ID='11111111-2222-3333-4444-555555555555'
$ nmcli -f NAME,UUID connection show "$PROFILE_ID"
NAME UUID
Office wired 11111111-2222-3333-4444-555555555555
3. Save a record of the current state
Capture the profile as text before opening the editor. Treat this as a comparison record, not something to paste blindly back into NetworkManager. It can contain wireless or VPN secrets, so lock it down and remove it once you are done:
$ nmcli connection show "$PROFILE_ID" > "$HOME/network-profile-before.txt"
$ chmod 600 "$HOME/network-profile-before.txt"
$ grep -E '^(connection\.id|connection\.uuid|connection\.type|ipv4\.|ipv6\.|802-11-wireless\.ssid)' "$HOME/network-profile-before.txt"
connection.id: Office wired
connection.uuid: 11111111-2222-3333-4444-555555555555
connection.type: 802-3-ethernet
ipv4.method: auto
ipv6.method: auto
The fields you see depend on the connection type. Never publish this record or paste it into a support ticket without checking for passwords, private keys and other secrets first.
4. Open the profile in nmtui-edit
Launch the editor with the exact name or UUID:
$ nmtui-edit "$PROFILE_ID"
- Move around with arrows or Tab, use Space to toggle a checkbox, and follow the on-screen key hints.
- It can also add or delete profiles from its connection list. Stay with the profile you identified and skip any delete action.
- Change one setting at a time. A wired profile may expose IPv4 configuration, DNS and routes; a Wi-Fi profile may expose SSID, security and saved secrets. Do not copy an address, gateway or DNS value from an example into your real network; use values from your network administrator or the service you are joining.
Checkpoint
Before saving, review the profile name, interface association, addressing method and any changed value. If a setting looks unfamiliar, leave without saving and compare against the record from step 3.
5. Save only after reviewing the change
Use the editor's save or OK action, then quit. Saving writes the profile through NetworkManager; it does not mean every change is already applied to the active interface, and it does not prove the new values work.
Compare the saved profile with what you intended straight away:
$ nmcli -f NAME,UUID,TYPE,DEVICE connection show "$PROFILE_ID"
NAME UUID TYPE DEVICE
Office wired 11111111-2222-3333-4444-555555555555 ethernet enp1s0
$ nmcli connection show "$PROFILE_ID" | grep -E '^(connection\.id|connection\.uuid|ipv4\.|ipv6\.)'
connection.id: Office wired
connection.uuid: 11111111-2222-3333-4444-555555555555
ipv4.method: auto
ipv6.method: auto
Use the before-and-after record to check the specific field you changed. Saved something unwanted? Reopen the profile, restore the old value from your private record, and save again. If the active connection became unusable, reach for a local console or another working connection before trying to reconnect.
6. Test activation separately
Editing a profile and activating it are two different operations. Only activate it when you have a maintenance window or a fallback connection, because a reconnect can interrupt SSH and other traffic:
$ nmcli connection show "$PROFILE_ID"
NAME UUID TYPE DEVICE
Office wired 11111111-2222-3333-4444-555555555555 ethernet enp1s0
For an explicit test, use nmtui's connect activity or the separately documented nmcli connection up command. Never run activation automatically as part of a remote edit. After a planned reconnect, verify:
$ nmcli -f GENERAL.STATE,GENERAL.CONNECTION device show enp1s0
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: Office wired
Your device name and state will depend on the host. A saved profile can be perfectly valid while activation still fails because a cable, access point, DHCP server or authentication service is unavailable.
7. Clean up the recovery record
Keep the before-state record until the connection has passed its real test, then remove it because it may hold secrets:
$ rm -- "$HOME/network-profile-before.txt"
Warning
This deletion is irreversible. If you still need the record for an approved change log, move it to an access-controlled location instead of leaving it in a shared home directory.
Done means
- Confirmed the tooling: the NetworkManager package and nmtui-edit help available on this host.
- Opened the right profile: by an exact name or UUID, not a guess.
- Recorded the old settings before saving any change.
- Reviewed and verified the changed values after saving.
- Treated activation as a separate test, potentially disruptive on its own.
- Can restore an unwanted edit from the before-state record, and removed that record once it was no longer needed.