_privdrop_unix.py 文件源码

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

项目:py_daemoniker 作者: Muterra 项目源码 文件源码
def daemote(pid_file, user, group):
    ''' Change gid and uid, dropping privileges.

    Either user or group may explicitly pass None to keep it the same.

    The pid_file will be chown'ed so it can still be cleaned up.
    '''
    if not _SUPPORTED_PLATFORM:
        raise OSError('Daemotion is unsupported on your platform.')

    # No need to do anything special, just chown the pidfile
    # This will also catch any bad group, user names
    shutil.chown(pid_file, user, group)

    # Now update group and then user
    _setgroup(group)
    _setuser(user)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号