mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-22 12:34:17 +00:00
py-i2phosts-master: chown log_file before daemonization
Master log file first opened as root, than daemonization with privilege drop happens and master then unable to log to this logfile because of insufficient permissions. So chown logfile to "runas" user to avoid this situation.
This commit is contained in:
parent
3b18825e4d
commit
e2c2eeeaae
@ -160,6 +160,7 @@ if not args.debug and not args.verbose:
|
||||
pw_entry = pwd.getpwnam(runas)
|
||||
d.uid = pw_entry[2]
|
||||
d.gid = pw_entry[3]
|
||||
os.chown(config['log_file'], d.uid, d.gid)
|
||||
d.open() # become daemon
|
||||
log = get_logger(filename=log_file, log_level=log_level)
|
||||
log.info('started')
|
||||
|
Loading…
x
Reference in New Issue
Block a user