2

How can I change the system namespace value of a process created by subprocess.Popen in Linux environment?

Need to set following namespaces just after subprocess.Popen(sys.argv[1:])

  • syscall.CLONE_NEWUTS
  • syscall.CLONE_NEWPID
  • syscall.CLONE_NEWNS
tomix86
  • 1,336
  • 2
  • 18
  • 29
Arush Salil
  • 163
  • 2
  • 10
  • 1
    `unshare()` can be used for `CLONE_NEWUTS` and `CLONE_NEWNS`, but (obviously) not for `CLONE_NEWPID`, since the new process already exists *after* `Popen()`. If you need that, you will need to hack `Popen()` to dispatch to `clone()` with the appropriate flags instead of the normal `fork()`. – dhke Jan 14 '18 at 09:33

0 Answers0