daemon.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:bitmask-dev 作者: leapcode 项目源码 文件源码
def change_process_owner(uid, gid):
    """ Change the owning UID and GID of this process.

        :param uid: The target UID for the daemon process.
        :param gid: The target GID for the daemon process.
        :return: ``None``.

        Set the GID then the UID of the process (in that order, to avoid
        permission errors) to the specified `gid` and `uid` values.
        Requires appropriate OS privileges for this process.

        """
    try:
        os.setgid(gid)
        os.setuid(uid)
    except Exception as exc:
        error = DaemonOSEnvironmentError(
            "Unable to change process owner ({exc})".format(exc=exc))
        raise error
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号