Created
April 7, 2015 14:47
-
-
Save cgwalters/1aa68b1b9642496f30f8 to your computer and use it in GitHub Desktop.
python setns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import ctypes | |
import sys | |
import os | |
import subprocess | |
f = None | |
libc = ctypes.CDLL('libc.so.6') | |
myfd = os.open('/proc/1/ns/mnt', os.O_RDONLY) | |
libc.setns(myfd, 0) | |
subprocess.Popen(['ls', '/home']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment