Running openconnect as a non-root user without any root privileges—even for initial setup—is possible, but it requires some configuration and limitations. Here’s how you can achieve this:
openconnect can run entirely in user space if you use the --interface option to specify a tun/tap device that the user has access to. However, by default, creating tun/tap interfaces requires root privileges.
If you can get a one-time root access (or ask an admin), you can create a persistent tun/tap device and grant your user permissions to it:
bash# As root (one-time setup): ip tuntap add mode tun user <your_username> name vpn0 chown <your_username> /dev/net/tun
After this, your user can use vpn0 without root.
But since you want no root at all, this is not an option.
--no-dtls and --no-esp (If Supported)Some VPN servers support running openconnect without kernel-level networking (DTLS/ESP). This allows it to run entirely in user space, but:
Example:
bashopenconnect --no-dtls --no-esp vpn.example.com
openconnect with vpnc-script in User SpaceIf your VPN server supports running in user space (e.g., over a plain TCP connection), you can use:
bashopenconnect --protocol=anyconnect vpn.example.com
But this depends on the server configuration.
If openconnect cannot run without root, consider alternatives like:
wireguard-tools with WG_USERSPACE=1.If you can run containers as a non-root user (e.g., with podman), you can run openconnect inside a container where it has the necessary permissions:
bashpodman run --rm -it --net=host --device=/dev/net/tun openconnect/openconnect vpn.example.com
This isolates the VPN process but still requires /dev/net/tun access.
If your goal is to access restricted resources, consider using a proxy (e.g., ssh -D or 3proxy) instead of a VPN.
--no-dtls --no-esp/dev/net/tun accessIf you absolutely cannot use root at any time, your best options are:
--no-dtls --no-esp (if the server supports it).Would you like help testing if your VPN server supports user-space connections?
Vibe can make mistakes. Check answers. Learn more