I've been trying to finagle pytun to do my bidding in creating persistent ssh tunnels, but I very much do not want these to be owned by root and unless I modify the python package myself (which as a responsible person, I probably should) I can't use it to create a persistent SSH tunnel (unless I ssh as root), there's no notion of "ownership" exposed by the package.

What I want to do is either:

  1. Create a tun interface using pytun ran as a non-root user and have it owned by that user in the first place.
  2. Create the tun interface as root using pytun and then change ownership somehow. (from the help of 'ip tuntap help' I don't think this is easy)
  • 1
    you can't create tun interfaces as non-root user so the (1) is out. – Jakuje Jan 25 '16 at 21:10
  • @jak is that a best practice or a complete impossibility? – Peter Turner Jan 25 '16 at 22:03
  • 2
    it is sane limitation in kernel: CAP_NET_ADMIN is required for creating network devices – Jakuje Jan 25 '16 at 22:05
  • Network devices don't have "users" (or any sort of permissions), so this makes little sense. – vonbrand Jan 26 '16 at 23:04
  • @vonbrand run ip tuntap add dev tun99 mode tun user vonbrand – Peter Turner Jan 27 '16 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.