如何从非根Debian Linux守护程序登录? [英] How should I log from a non-root Debian Linux daemon?
问题描述
我发现/ var / log只有root权限,所以我的守护进程不能在那里写日志文件。
但是,如果它写在那里,它将会获得自动日志轮换,并且还可以像用户期望的那样工作。 p>
守护进程写入/ var / log中出现的日志条目的推荐方法是什么,而不必以root身份运行?
守护程序是一个网络服务器,所以日志流量将类似于Apache。
你应该创建一个子目录,如 / var / log / mydaemon
具有守护进程的用户所有权
I'm writing a new daemon, which will be hosted on Debian Linux.
I've found that /var/log has root only write permissions, so my daemon cannot write log files there.
However, if it writes there, it appears it will gain automatic log rotation, and also work as a user might expect.
What is the recommended way for a daemon to write log entries that appear in /var/log, without having to be run as root?
The daemon is a webserver, so the log traffic will be similar to Apache.
You should create a subdirectory like /var/log/mydaemon
having the daemon's user ownership
这篇关于如何从非根Debian Linux守护程序登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!