0

I'm trying to create a tun device with rust's tun_tap create, I'm following documentation and trying to create an interface with the tun_tap::Iface::new(..);, but I'm getting the error below.

Error: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }

I'm running Ubuntu 20.04 Lts version on this machine, How can I run this code without giving it root permission? Is this anything that I can do with the code or with Linux permission itself? any ideas would be appreciated ;)

Herohtar
  • 5,347
  • 4
  • 31
  • 41
Emad Baqeri
  • 2,333
  • 2
  • 14
  • 29
  • 2
    I think you don't actually need root but `CAP_NET_ADMIN`, if that is acceptable. Try with `setcap cap_net_admin+ep binaryprogram` after compiling. – rodrigo Apr 21 '22 at 23:11
  • 3
    Maybe this will help you https://unix.stackexchange.com/questions/557306/how-to-allow-non-root-user-to-create-tun-devices. – jthulhu Apr 22 '22 at 05:03

0 Answers0