错误:创建状态文件/ var/lib/logrotate/status时出错:权限被拒绝

Vic*_*r S 15 ubuntu logrotate

尝试使用logrotate,当我在logrotate.d中运行特定定义的日志循环脚本时,我收到以下错误

error: error creating state file /var/lib/logrotate/status: Permission denied

/var/lib/logrotate$ ls -lah
total 12K
drwxr-xr-x  2 root root 4.0K 2012-05-11 06:25 .
drwxr-xr-x 43 root root 4.0K 2012-05-18 08:07 ..
-rw-r--r--  1 root root  911 2012-05-25 06:25 status
Run Code Online (Sandbox Code Playgroud)

我没有触及那条路,所以我想知道为什么它会默认创建一个错误...

Ray*_*yne 30

请勿 chmod将默认状态文件设置为666.如果你chmod这样,系统上的每个用户都可以logrotate用作攻击媒介.

只需为您的用户定义一个(私有)状态文件(假设您尝试以普通用户身份运行它)并带有选项[-s|--state file].


cez*_*zar 6

您确定以 root 身份运行此命令...?;) 如果是这样,请检查系统上是否有 AppArmour - 如果是,请检查其配置或卸载它(Ubuntu 情况)。