swap order of setuid and setgid

This commit is contained in:
Balakrishnan Balasubramanian 2018-12-18 16:21:03 -05:00
parent 54873f51be
commit defe40ee0c

View File

@ -95,8 +95,8 @@ def drop_privileges(future):
sys.exit(1) sys.exit(1)
nobody = pwd.getpwnam('nobody') nobody = pwd.getpwnam('nobody')
try: try:
os.setuid(nobody.pw_uid)
os.setgid(nobody.pw_gid) os.setgid(nobody.pw_gid)
os.setuid(nobody.pw_uid)
except PermissionError: except PermissionError:
logging.error("Cannot setuid nobody; run as root") logging.error("Cannot setuid nobody; run as root")
sys.exit(1) sys.exit(1)