I am trying to use os.setuid in an unshared user namespace, but it returns an error, which I cannot seem to find happening to anyone anywhere.
Code (this is a MRE, not part of my program):
import os
os.unshare(os.CLONE_NEWUSER)
os.setuid(0)
os.setgid(0)
os.system('/bin/bash')
Error:
Traceback (most recent call last):
File "path/to/mre/mre.py", line 3, in <module>
os.setuid(0)
OSError: [Errno 22] Invalid argument
Can anyone help me out here?