Created
June 9, 2017 09:12
-
-
Save pgiraud/a02f9caf53ea6f0a8583cfb440fc9d19 to your computer and use it in GitHub Desktop.
Test effective userid python subprocess
This file contains hidden or 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
#! /bin/python | |
import subprocess | |
import os | |
print("subprocess.call") | |
print("Without seteuid") | |
subprocess.call(['id', '-u']) | |
print("With seteuid") | |
os.seteuid(int(os.getenv('USERID'))) | |
subprocess.call(['id', '-u']) | |
print("Script bash") | |
subprocess.call(['./script.sh']) |
This file contains hidden or 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
#! /bin/bash | |
echo `id -u` |
bersace
commented
Jun 9, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment