nlzy / nsproxy

Make arbitrary applications to use a specified SOCKS / HTTP proxy
GNU General Public License v2.0
225 stars 25 forks source link

create net_namespace failed: Operation not permitted #3

Closed wholenewx closed 9 months ago

wholenewx commented 9 months ago

Hello nlzy

I use nsproxy in a debian 10 and when I exec ./nsproxy -x xxx -x xxx ... , it shows :

nsproxy: create net_namespace failed: Operation not permitted nsproxy: nsproxy can't run on this system. The OS is debian 10

uname -r 4.19.0-25-amd64

Is there a dependency missing? Please help me, thanks

nlzy commented 9 months ago

Hi,

Unprivileged user-namespace is disabled by defualt on Debian 10.

Use this command to enable it, then nsproxy should work:

sudo sysctl -w kernel.unprivileged_userns_clone=1

This setting will be discarded on next reboot, use this command to save permanently:

echo 'kernel.unprivileged_userns_clone=1' | sudo tee /etc/sysctl.d/00-local-userns.conf

Or consider upgrading your OS to Debian 11+, which enable this feature by default, see https://www.debian.org/releases/bullseye/amd64/release-notes/ch-information.en.html#linux-user-namespaces

wholenewx commented 9 months ago

Hi nlzy

Thanks a lot!

I had updated the kernel of Debian 10 from 4.19 to 5.10 and now nsproxy works good.

Next time, with your advice, no kernel update is needed, it's more convenient.

Thanks again!