#!/dcs/bin/python import sys import os import pwd #>>> import os #>>> os.setgroups([48]) #>>> os.setuid(48) #>>> os.execl('/bin/bash','/bin/bash') def usage(): sys.stderr.write('pretend \n') sys.exit(0) if len(sys.argv) <> 2: usage() username = sys.argv[1] pwent = pwd.getpwnam(username) print pwent #sshd::88:88:ssh acct:/:/bin/false uid=pwent[2] gid=pwent[3] os.setgroups([gid]) os.setuid(uid) os.system('id') os.execl('/dcs/bin/bash','/dcs/bin/bash')