X11 forwarding puts the editor's window on your laptop while the process keeps running on the remote host. That gap is the whole trap: you are looking at a local window and editing a remote profile, and a wrong assumption about which machine owns the change can cut the SSH link you are working over. The checklist below fixes the host and the profile before anything is saved. Each step has a stop condition, so a failure early is cheap.

Step 1: name the machine that owns the profile

Run the identity commands in the shell you are about to configure, and read the answer instead of assuming it from the prompt. A hostname in a prompt is a string your shell printed; the kernel's hostname is what the rest of this checklist trusts. If the two disagree, you are on the wrong machine or the prompt is decorated by your local shell. Stop and reconnect to the intended host before continuing.

hostnamectl
hostname -f
ip -brief address

The next question is whether this machine should hold the VPN at all. Configuring the laptop's client and configuring the remote host's client produce different routes, different DNS and different failure modes. Decide which one you mean before you touch a profile, and write the decision down where the next person will find it.

Step 2: read the profile by UUID, not by label

NetworkManager identifies a connection by UUID, while the name is a label that anyone can edit or duplicate. List both and match the entry you actually intend, especially on a host where several VPN profiles were imported over the years.

nmcli -f NAME,UUID,TYPE connection show
nmcli connection show --active
nmcli general permissions

Saved entries and active connections answer different questions: the first lists what exists, the second lists what is carrying traffic right now. The permissions line describes local policy for your session and says nothing about whether the VPN gateway will accept the account. If the profile you need is not in the saved list, stop here, because editing the wrong entry is worse than not editing at all.

Once you have the UUID, put it in a variable and use that variable in every later command. It removes a class of copy-paste mistakes and makes the transcript reproducible.

UUID=$(nmcli -g UUID connection show 'Corp VPN')
nmcli connection edit uuid "$UUID"

Step 3: decide whether a graphical editor is the right tool

An editor that needs a polkit prompt or a secret agent will not get one just because its window appears on your laptop. Those components run in the remote session's context, and forwarding a display does not forward them. If the editor fails to save with an authorization or secret error, the display is not the problem.

echo "$DISPLAY"
ssh -X you@vpn-host
xauth list

OpenSSH enables X11 forwarding with -X and documents the caution that goes with it: the remote host can reach your local display, which is a real trust boundary. Trusted forwarding with -Y removes some of those checks and should never be the reflex fix for an application that fails under the default. If your organisation publishes a remote-administration method, use that one instead of inventing a variant. In most cases the command-line editor is the smaller surface and the better answer.

Stop here if the only working path requires -Y and you cannot explain why. That is a decision for whoever owns the security policy, not a workaround to keep in a personal script.

Step 4: keep a recovery path before you activate anything

A VPN change can remove the route your SSH session depends on, so arrange a way back before you activate the profile. Console access, an out-of-band management address or a scheduled rollback all count; a hope that the change works does not.

sudo systemctl status NetworkManager
ip route show default
ss -tn state established '( sport = :22 )'

Activate the intended profile only, then verify from the remote host: the default route, the SSH return path and one resource that should be reachable through the tunnel. A successful check from your laptop tests the laptop's path and tells you nothing about the remote host. If the session drops, use the recovery path rather than reconnecting blind. Saving a profile is not activation, and activation is not verification.

Record the UUID, the property values you changed and the commands you used to verify them. The next person to touch this host will need all three, and a transcript is worth more than a summary that says the VPN was fixed. A checklist that ends without a rollback note is half a checklist.

ተዛማጅ ጽሑፎች