What is difference between os.getuid() and os.geteuid()?

前端 未结 2 735
囚心锁ツ
囚心锁ツ 2020-12-29 19:39

The documentation for os.getuid() says:

Return the current process’s user id.

And of os.geteuid() says

2条回答
  •  青春惊慌失措
    2020-12-29 20:06

    Function os.getuid() returns ID of a user who runs your program. Function os.geteuid() of a user your program use permissions of. In most cases this will be the same. Well known case when these values will be different is when setuid bit is set for your program executable file, and user that runs your program is different from user that own program executable. In this case os.getuid() will return ID of user who runs program, while os.geteuid() will return ID of user who own program executable.

提交回复
热议问题