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)
评论列表
文章目录