我认为我的一台 Ubuntu 服务器上的日志文件有点乱,需要一些建议和方法来解决它。当日志轮换发生时,我看到很多这样的错误:
error: failed to rename /var/log/dovecot.log to /var/log/dovecot.log.1: Permission denied
error: failed to rename /var/log/mail.err to /var/log/mail.err.1: Permission denied
error: failed to rename /var/log/mail.log to /var/log/mail.log.1: Permission denied
error: failed to rename /var/log/owncloud.log to /var/log/owncloud.log.1: Permission denied
error: error renaming /var/log/syslog.5 to /var/log/syslog.6: Permission denied
error: error renaming /var/log/amavis.log.3 to /var/log/amavis.log.4: Permission denied
error: error renaming /var/log/auth.log.3 to /var/log/auth.log.4: Permission denied
error: error renaming /var/log/nginx/access.log.6 to /var/log/nginx/access.log.7: Permission denied
error: error renaming /var/log/nginx/error.log.8 to /var/log/nginx/error.log.9: Permission denied
error: error renaming /var/log/kern.log.3 to /var/log/kern.log.4: Permission denied
我的 logrotate 配置内容 (/etc/logrotate.conf.daily)
daily
rotate 3
missingok
su root syslog
include /etc/logrotate.d/daily
/etc/loggrotate.daily/syslog.daily 下的 syslog logrotation 配置是
/var/log/syslog {
su root syslog
rotate 5
missingok
postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript
create 644 root syslog
}
我现在的问题是:
根
/var/log
目录应该具有什么权限?目前它有drwxr-xr-x 12 root syslog 4.0K Mar 19 11:48 log
什么问题吗?有什么技巧或命令可以让我找出每个日志文件所需的权限?例如 dovecot.log,要设置哪些用户/组/文件权限?这适用于上述所有日志文件。
非常感谢