VPNSmith
self-host-vpnINFO

WireGuard: remove a peer without restarting — and make it stick (2026)

wg set peer remove takes effect instantly and disappears on the next wg-quick down/up. The difference between the running state and the config file, why the peer comes back, and the order of operations that actually revokes access.

By Eric Gerard · Founder · VPNSmith - Self-host VPN & GDPR VPS specialist4 min readPhoto via Pexels

You removed the peer. wg show confirms it is gone. A week later the laptop you revoked connects again, and nothing in your logs explains it.

Nothing went wrong. WireGuard simply has two states, and the command you used only changed one of them.

The two states

what it iswhat changes it
running statewhat the kernel currently acceptswg set, wg syncconf
configuration filewhat gets loaded on the next startyour editor, wg-quick save

wg set wg0 peer PUBLIC_KEY remove acts on the first. It is immediate, it leaves every other peer connected, and it never touches /etc/wireguard/wg0.conf.

So the next wg-quick down wg0 && wg-quick up wg0 — a reboot, a package upgrade, a systemd restart you did not think about — reads a file that still contains the peer, and puts it back. Nobody is notified. The access simply resumes.

Removing it for good

Two orders of operation, and the second is the one to prefer.

The quick one, when the file has nothing you care about:

sudo wg set wg0 peer PUBLIC_KEY remove
sudo wg-quick save wg0

wg-quick save writes the running state back to the file. It works — and it rewrites the file from the kernel's point of view. Your comments disappear. On a server with a dozen peers, those comments are usually the only record of which peer is which laptop. Losing them turns a readable config into a list of anonymous public keys.

The one to prefer, which keeps the file authoritative:

sudo nano /etc/wireguard/wg0.conf        # delete the whole [Peer] block
sudo wg syncconf wg0 <(wg-quick strip wg0)

wg syncconf applies the file to the running interface without bringing it down: only what changed is affected, and the other tunnels keep their sessions. wg-quick strip removes the directives the kernel does not understand — Address, DNS, PostUp — and prints what remains.

The distinction matters on a server with several clients: wg-quick down && up drops everyone for a couple of seconds to revoke one peer.

Two flat keys on a ring hanging from a pale metal plate mounted on a light wooden door, the upper key engraved with the initials R.M.I.
Two flat keys on a ring hanging from a pale metal plate mounted on a light wooden door, the upper key engraved with the initials R.M.I.

Two flat keys on a single ring, hanging from a pale metal plate screwed to a light wooden door. The upper key carries the engraved initials « R.M.I. ». Warm tones, visible wood grain.

Verify in both places, not one

sudo wg show wg0 peers                        # what the kernel accepts now
grep PublicKey /etc/wireguard/wg0.conf        # what loads next time

A key absent from the first and present in the second is a revocation with an expiry date. It is the exact situation this article exists for, and it is invisible until the day the interface restarts.

What revoking does not do

Removing the peer means the server refuses the handshake. The key material on the lost device becomes useless against this server. That is real, and it is where the effect stops.

The configuration file is still on that device. So is its private key, and whatever else the device held — a session that was still open, a password manager left unlocked, the mailbox that can reset your other accounts. Revoking the tunnel is the right first move. It is not the whole response, and treating it as such is how people end up perfectly confident and still exposed.

Situate your own attack surface — 10 questions, about three minutes, no account, no email, nothing stored. The result names the one change that reduces your exposure the most, and for someone who self-hosts it is rarely another firewall rule.

In short

What you didWhat it actually changed
wg set … peer … removethe running state only — reverts on restart
wg-quick savethe file too, at the cost of your comments
edit the file, then wg syncconfboth, without dropping the other peers
revoked after losing a devicethe tunnel, not what the device still holds

One line worth keeping: a peer removed from memory and left in the file is not removed, it is postponed.

★ Nuremberg GDPR datacenter · ✓ Dedicated IPv4 included · 200+ Mbps guaranteed

Self-host your VPN on your own VPS → ContaboFull root access · public IPv4 · pick your region

Frequently asked questions

How do I remove a WireGuard peer without restarting the tunnel?
Use wg set wg0 peer PUBLIC_KEY remove. It takes effect immediately, the other peers are untouched, and no interface goes down. What it does not do is edit your configuration file: the peer is gone from the running state only, and it will come back the next time the interface is brought up from that file.
Why does the peer I removed come back?
Because you removed it from memory, not from disk. WireGuard has two separate states: what the kernel currently holds, which wg set changes, and what /etc/wireguard/wg0.conf contains, which wg-quick reads at startup. Remove the peer from one and not the other and the next wg-quick down and up restores it, silently. This is the most common way an access is believed to be revoked while it still works.
What does wg-quick save actually do?
It writes the current running state back into the configuration file, which does make the removal permanent. The cost is that it rewrites the file from the kernel's point of view: comments disappear, ordering changes, and anything wg-quick does not model — your own annotations naming which device each peer belongs to — is lost. On a server with a dozen peers, those comments are usually the only thing telling you who is who.
How do I check that a peer is really gone?
Two commands, because there are two states. wg show wg0 peers lists what the kernel currently accepts. grep PublicKey /etc/wireguard/wg0.conf shows what will be loaded next time. A peer absent from the first and present in the second is a revocation that expires at the next restart.
Is removing a peer enough after losing a device?
For the tunnel, yes: without a matching peer entry the server refuses the handshake, and the key material on the lost device becomes useless against it. It does nothing about the device itself. The configuration file, its private key and whatever else that device held are still there, in someone else's hands. Revoking is the right first move; it is not the whole response.