Home / Alt manpages / nmtui(1)

  • nmtui(1)
  • User command
  • linux

Edit Connections Over SSH with nmtui

No X server, no GUI, still need to fix a network profile: that is exactly what nmtui is for. This guide uses it to edit an existing NetworkManager connection, activate or deactivate it, and change the system hostname when that is genuinely required. The examples match NetworkManager 1.46.0, supplied here by the network-manager package. Allow about fifteen minutes for a connection change, plus time to test the result.

You need a terminal with a usable text interface and NetworkManager running. Most inspection and selection can start as your ordinary user. Saving a connection or changing the hostname can trigger an authentication prompt, depending on the machine's policy, so have an administrator available when you expect that.

1. Check the installed command

Confirm which executable will run and record the installed package version. These are read-only checks and do not need sudo:

$ command -v nmtui
/usr/bin/nmtui
$ dpkg-query -W -f='${Package} ${Version}\n' network-manager
network-manager 1.46.0-1ubuntu2.8
$ nmtui --help
Usage:
  nmtui [OPTION...]

The manpage describes three activities: edit for connection profiles, connect for activation and deactivation, and hostname for the system hostname. Running plain nmtui opens an activity chooser.

Checkpoint

If command -v finds nothing, stop and install or repair NetworkManager through your normal package-management process. Do not copy a different nmtui binary into /usr/bin.

2. Open the connection editor

Start with a profile name that already exists. Replace the placeholder with the exact connection name NetworkManager shows you:

$ nmtui edit 'CONNECTION_NAME'
  • Takes a name or ID. If you know neither, run plain nmtui, choose the edit activity, and pick a profile from the list.
  • Can add, modify, view and delete profiles. Read the selected name carefully before confirming anything.
  • Nothing saves until you say so. Use the terminal's normal cursor keys and on-screen controls to move between fields; a highlighted field is not a saved change until you follow the interface to save explicitly, or leave without saving if you were only inspecting.

Safety boundary

Changing IPv4 addresses, routes, DNS servers, Wi-Fi credentials or connection autoconnect behaviour can interrupt the current session. Save such a change only when you have console access, a second management path, or a documented recovery plan.

3. Make one small change and verify it

Change one setting at a time. To correct a connection's DNS configuration, for example, select the existing profile, alter only its DNS field, then save it through the editor. The exact fields available depend on the connection type and the installed NetworkManager build.

After saving, return to the activity chooser or exit nmtui. Verify the connection using NetworkManager's command-line client:

$ nmcli connection show 'CONNECTION_NAME'
$ nmcli device status

The first command should identify the profile, the second shows whether a device is connected. Output varies with the machine, so check the connection name and device state rather than expecting a fixed table.

If the change broke connectivity, reopen the same profile and restore the previous value. If you wrote down the old address, route or DNS values before editing, recovery is a direct reversal. Otherwise use the editor's current values and your network's known-good configuration as the reference. Do not delete the profile as a first response.

4. Activate or deactivate a profile

Use the connect activity when the profile already exists and the immediate task is to bring it up or down:

$ nmtui connect 'CONNECTION_NAME'

The argument may be a connection name, UUID, device name or Wi-Fi SSID. For an interactive list, omit the argument:

$ nmtui connect

Select the intended profile or network, then confirm the action the interface shows you. Activation can replace the route your terminal is using, and deactivation can disconnect the machine outright. Do not deactivate the only management connection on a remote host unless you have out-of-band access.

Check the result after leaving the interface:

$ nmcli device status
$ nmcli connection show --active

If activation fails, check that the device is present, the SSID or profile name is exact, and any required credentials are available. A privilege prompt is an authorisation decision, not an invitation to paste a password into the connection name.

5. Change the hostname deliberately

The hostname activity changes the system hostname, not a NetworkManager connection profile:

$ nmtui hostname

Record the existing value before saving. You can inspect it without changing state:

$ hostnamectl hostname

Enter the new hostname only if you understand how local naming, certificates, monitoring and remote access use it. Saving may require elevated authorisation. After saving, verify:

$ hostnamectl hostname
new-hostname.example.test

To recover, run nmtui hostname again and restore the value you recorded. Do not assume changing the hostname also updates DNS, certificate names or every application configuration that reads it.

6. Avoid the common traps

  • Plain nmtui opens a chooser. nmtui edit, nmtui connect and nmtui hostname select an activity directly.
  • edit and connect take different identifiers. An SSID is valid for connect; the documented edit form uses a connection name or ID.
  • A successful save means acceptance, not reachability. NetworkManager accepted the profile change, but that does not prove the device can reach the intended gateway or DNS service.
  • Do not add sudo automatically. Use elevation only when the system asks for authorisation, and inspect the action before approving it.
  • Do not delete a profile to undo a failed activation. Restore the previous value or select another known-good profile instead.

Done means

  • Confirmed the installed nmtui and NetworkManager version.
  • Selected the intended activity and profile before confirming a change.
  • Verified the resulting device or active-connection state with nmcli.
  • Kept a recovery path before changing a route, address, DNS setting or remote host connection.
  • Any hostname change was recorded and can be reversed from nmtui hostname.