Last active
February 16, 2016 03:38
-
-
Save synackme/e62a1e8386d72a95e0e4 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
import sys, subprocess, getopt | |
if len(sys.argv) != 2: | |
print "Usage: osx_add_user_to_group.py <user>" | |
sys.exit(1) | |
for arg in sys.argv[1:]: | |
bashCommand1 = "sudo dseditgroup -o edit -a %s -t user admin" % sys.argv[1] | |
bashCommand2 = "sudo dseditgroup -o edit -a %s -t user wheel" % sys.argv[1] | |
process = subprocess.Popen(bashCommand1.split(), stdout=subprocess.PIPE) | |
output = process.communicate()[0] | |
process = subprocess.Popen(bashCommand2.split(), stdout=subprocess.PIPE) | |
output = process.communicate()[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment