如何从非根Debian Linux守护程序登录? [英] How should I log from a non-root Debian Linux daemon?

查看:132
本文介绍了如何从非根Debian Linux守护程序登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个新的守护进程,它将在Debian Linux上托管。



我发现/ 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆