Node HandbookNODE HANDBOOK
TUN capture

Clash Verge Rev: TUN device permission denied

TUN mode does not open a socket — it asks the kernel to create a network interface. That request is privileged by design, so a core running as an ordinary user is refused before any traffic exists.

Last updated: 2026-11-24 · Every error string on this page was reproduced on a real client.

Why TUN needs privilege at all

A proxy listener is an ordinary socket. Any process can open one on a high port, which is why proxy mode works without elevation. TUN is different: it creates a virtual network interface, assigns it an address, and changes the system routing table so that traffic is steered into it.

Those operations affect every process on the machine, so the operating system gates them. A refused request produces a permission error at the moment the device is created, which is early in startup — before any node is contacted.

This is why TUN fails where the proxy works. The two modes have entirely different privilege requirements, and a client that connected fine in proxy mode can be refused in TUN mode on the same machine with the same account.

What each platform requires

PlatformRequirementTypical message
LinuxThe capability to administer the network, or rootoperation not permitted
macOSRoot, or a signed helper with the network extension entitlementpermission denied, or a prompt that was declined
WindowsElevation to install and load the virtual adapter driverpermission denied, or a driver load failure

Linux is the case that gets reported most, because it produces the message with no prompt and no explanation. The capability model means a binary can be granted exactly the rights it needs without running as root, which is the correct fix and also the one people skip.

Linux: grant the capability, do not run as root

Two capabilities are involved: one to administer the network, one to use raw sockets. Granting them to the core binary lets that specific file perform the operation while the process runs as an ordinary user:

sudo setcap cap_net_admin,cap_net_raw+ep /path/to/verge-mihomo

Three details decide whether this works:

  • The path must be the binary that actually runs. A client that bundles its core in a versioned directory can update it, and the capability is lost when the file is replaced. Re-apply after every update, or use the client's service mode which is designed to survive this.
  • The filesystem must support extended attributes. A binary on a mount that does not preserve them silently loses the capability, and the error returns with no change having been made.
  • The capability can be lost on copy. Moving or copying the file usually drops it, because the attribute is not carried by ordinary file operations.

Verify with getcap on the exact path after applying it, rather than assuming the command succeeded.

The service route, which is more durable

Most desktop clients offer a service or helper mode for exactly this problem: a small privileged component starts the core or performs the privileged setup, while the interface stays unprivileged. That is the better architecture because the privilege is installed once, survives application updates, and does not depend on a file attribute.

When service mode is available and the TUN error appears, check whether the service is actually installed and running before changing anything else. An installation that was started and not completed leaves the client believing the service exists while nothing answers — and the symptom is this permission error, because the privileged call is attempted and refused.

macOS and Windows in brief

On macOS the requirement is either running the core with elevated rights or using a signed helper. A declined authorisation prompt is the most common cause, and it is not repeated on every attempt, so the failure looks permanent. Check the client's own service state rather than re-authorising blindly.

On Windows the requirement is elevation to install the virtual adapter driver, which happens once, plus the right to load it afterwards. A driver that failed to install leaves a device that cannot be created, and the error can surface as a permission refusal rather than as a driver error. Looking at the driver's state is more informative than the client's message.

What not to conclude

This is not a node problem, not a configuration problem, and not a firewall problem. The refusal happens before any traffic exists, so nothing about the proxy path has been tested.

It is also not fixed by running the whole application as root on a desktop system. That grants far more than needed, makes the privilege permanent, and on Linux it can leave files in the configuration directory owned by root, which then breaks the unprivileged run later.

Frequently asked

Why does proxy mode work but TUN mode not?

Proxy mode opens a socket on a high port, which any process may do. TUN mode creates a network interface and edits the routing table, which the operating system restricts. The two have different privilege requirements on the same machine.

Is running as root the simplest fix?

It works and it is the wrong shape. Root grants everything permanently and can leave root-owned files in the configuration directory that break later unprivileged runs. A capability on the specific binary, or the client's service mode, grants only what is needed.

The capability disappears after an update. Why?

Capabilities are file attributes. Replacing the binary with a new file drops them. Re-apply after each update, or switch to a service-based setup where the privilege lives outside the file.

Could a security product be causing this?

On Windows, yes — a driver that was blocked or removed presents as an inability to create the device. On Linux, less likely, though mandatory access control policies can deny the capability even when it is present.

Does TUN mode need to stay on for the rule set to apply?

No. Rules apply in both modes; what differs is where traffic is captured. TUN captures at the packet layer so applications that ignore proxy settings are included, which is the reason to want it and also the reason it needs privilege.