Ignoring /etc/logrotate.conf because of bad file mode

14,702

You are changing permission on logrotate.d. you need to chmod 644 /etc/logrotate.conf And chown root:root /etc/logrotate.conf And then it could work

Share:
14,702

Related videos on Youtube

jenny
Author by

jenny

Updated on September 18, 2022

Comments

  • jenny
    jenny over 1 year

    How can I do logrotate? I can see no effect when I do logrotate:

    root@me-Latitude-E5550:/etc/logrotate.d# cd ..
    root@me-Latitude-E5550:/etc# cd ..
    root@me-Latitude-E5550:/# logrotate -d /etc/logrotate.conf
    Ignoring /etc/logrotate.conf because of bad file mode.
    
    Handling 0 logs
    root@me-Latitude-E5550:/# chmod 644 /etc/logrotate.d/*
    root@me-Latitude-E5550:/# cd /etc/logrotate.d
    root@me-Latitude-E5550:/etc/logrotate.d# ls
    apport       custom   pm-utils  speech-dispatcher    upstart
    apt          dpkg     ppp       ufw
    cups-daemon  lightdm  rsyslog   unattended-upgrades
    root@me-Latitude-E5550:/etc/logrotate.d# cd ..
    root@me-Latitude-E5550:/etc# cd ..
    root@me-Latitude-E5550:/# logrotate -d /etc/logrotate.conf
    Ignoring /etc/logrotate.conf because of bad file mode.
    
    Handling 0 logs
    root@me-Latitude-E5550:/# cd /var/log
    root@me-Latitude-E5550:/var/log# ls -larth
    total 34M
    drwxrwxrwx  2 root root   4,0K Feb 18  2016 speech-dispatcher
    drwxrwxrwx  2 root root   4,0K Mai 19  2016 upstart
    drwxrwxrwx  2 root root   4,0K Jul 19  2016 fsck
    -rwxrwxrwx  1 root root     31 Jul 19  2016 dmesg
    -rwxrwxrwx  1 root root    57K Jul 19  2016 bootstrap.log
    drwxrwxrwx  3 root root   4,0K Jul 19  2016 hp
    drwxr-xr-x 14 root root   4,0K Jul 19  2016 ..
    drwxrwxrwx  2 root root   4,0K Jun 14 13:17 apt
    drwxrwxrwx  2 root root   4,0K Jun 14 13:20 installer
    drwxrwxrwx  2 root root   4,0K Jun 19 09:50 unattended-upgrades
    -rwxrwxrwx  1 root root   3,8K Jun 19 09:55 fontconfig.log
    -rwxrwxrwx  1 root root    554 Jun 19 15:02 apport.log.1
    drwxrwxrwx  2 root root   4,0K Jun 20 07:35 lightdm
    -rwxrwxrwx  1 root root   836K Jun 20 07:35 syslog.1
    -rwxrwxrwx  1 root root    32K Jun 20 14:31 faillog
    -rw-------  1 root utmp    768 Jul 14 09:28 btmp
    drwxrwxrwx  2 root root   4,0K Jul 14 10:38 dist-upgrade
    -rwxrwxrwx  1 root root    43K Jul 14 10:45 alternatives.log
    -rwxrwxrwx  1 root root   286K Jul 14 11:04 lastlog
    drwxrwxrwx  2 root root   4,0K Jul 18 08:59 sysstat
    -rwxrwxrwx  1 root root   1,8M Jul 18 11:13 dpkg.log
    drwxrwxrwx  2 root root   4,0K Jul 18 12:19 cups
    -rw-r-----  1 root adm     14K Jul 18 12:20 apport.log
    -rw-r--r--  1 root root    32K Jul 18 18:38 Xorg.0.log.old
    -rwxrwxrwx  1 root root   1,9K Jul 18 18:44 gpu-manager.log
    -rw-r--r--  1 root root   1009 Jul 18 18:44 boot.log
    drwxrwxr-x 13 root syslog 4,0K Jul 18 18:44 .
    -rw-rw-r--  1 root utmp    85K Jul 18 18:45 wtmp
    -rw-r--r--  1 root root    29K Jul 18 21:17 Xorg.0.log
    -rwxrwxrwx  1 root root   5,7M Jul 18 21:18 kern.log
    -rwxrwxrwx  1 root root   580K Jul 18 21:50 auth.log
    -rwxrwxrwx  1 root root    24M Jul 18 21:54 syslog
    root@me-Latitude-E5550:/var/log# logrotate -f /etc/logroate.conf
    error: cannot stat /etc/logroate.conf: No such file or directory
    root@me-Latitude-E5550:/var/log# logrotate -f /etc/logrotate.conf
    root@me-Latitude-E5550:/var/log# ls -larth
    total 34M
    drwxrwxrwx  2 root root   4,0K Feb 18  2016 speech-dispatcher
    drwxrwxrwx  2 root root   4,0K Mai 19  2016 upstart
    drwxrwxrwx  2 root root   4,0K Jul 19  2016 fsck
    -rwxrwxrwx  1 root root     31 Jul 19  2016 dmesg
    -rwxrwxrwx  1 root root    57K Jul 19  2016 bootstrap.log
    drwxrwxrwx  3 root root   4,0K Jul 19  2016 hp
    drwxr-xr-x 14 root root   4,0K Jul 19  2016 ..
    drwxrwxrwx  2 root root   4,0K Jun 14 13:17 apt
    drwxrwxrwx  2 root root   4,0K Jun 14 13:20 installer
    drwxrwxrwx  2 root root   4,0K Jun 19 09:50 unattended-upgrades
    -rwxrwxrwx  1 root root   3,8K Jun 19 09:55 fontconfig.log
    -rwxrwxrwx  1 root root    554 Jun 19 15:02 apport.log.1
    drwxrwxrwx  2 root root   4,0K Jun 20 07:35 lightdm
    -rwxrwxrwx  1 root root   836K Jun 20 07:35 syslog.1
    -rwxrwxrwx  1 root root    32K Jun 20 14:31 faillog
    -rw-------  1 root utmp    768 Jul 14 09:28 btmp
    drwxrwxrwx  2 root root   4,0K Jul 14 10:38 dist-upgrade
    -rwxrwxrwx  1 root root    43K Jul 14 10:45 alternatives.log
    -rwxrwxrwx  1 root root   286K Jul 14 11:04 lastlog
    drwxrwxrwx  2 root root   4,0K Jul 18 08:59 sysstat
    -rwxrwxrwx  1 root root   1,8M Jul 18 11:13 dpkg.log
    drwxrwxrwx  2 root root   4,0K Jul 18 12:19 cups
    -rw-r-----  1 root adm     14K Jul 18 12:20 apport.log
    -rw-r--r--  1 root root    32K Jul 18 18:38 Xorg.0.log.old
    -rwxrwxrwx  1 root root   1,9K Jul 18 18:44 gpu-manager.log
    -rw-r--r--  1 root root   1009 Jul 18 18:44 boot.log
    drwxrwxr-x 13 root syslog 4,0K Jul 18 18:44 .
    -rw-rw-r--  1 root utmp    85K Jul 18 18:45 wtmp
    -rw-r--r--  1 root root    29K Jul 18 21:17 Xorg.0.log
    -rwxrwxrwx  1 root root   5,7M Jul 18 21:18 kern.log
    -rwxrwxrwx  1 root root   580K Jul 18 21:50 auth.log
    -rwxrwxrwx  1 root root    24M Jul 18 21:55 syslog
    root@me-Latitude-E5550:/var/log#
    
  • jenny
    jenny over 6 years
    nope , i did it, still no change in var/log sizes
  • Krzysztof Stasiak
    Krzysztof Stasiak over 6 years
    There same error on run in debug mode? logrotate -d /etc/logrotate.conf
  • jenny
    jenny over 6 years
    yeah same error... /var/log# logrotate -d /etc/logrotate.conf Ignoring /etc/logrotate.conf because of bad file mode. Handling 0 logs
  • jenny
    jenny over 6 years
    rwxrwxrwx 1 root root 703 Mai 6 2015 /etc/logrotate.conf is the output
  • Krzysztof Stasiak
    Krzysztof Stasiak over 6 years
    You have permision: 777, and need to Change them, only root can write this file. Did you have any error on chmod 644 ?
  • jenny
    jenny over 6 years
    I am running all these commands as root user by logging into root using sudo su .Should i use chown command logging out of root and logging into normal user?
  • Krzysztof Stasiak
    Krzysztof Stasiak over 6 years
    No, you can do that only as root, I have no idea why its no chmod file to 644
  • jenny
    jenny over 6 years
    Ahhh ... okay but i can get a clue from my previous runs though i do not understand the meaning of it sudo su- sudo: /etc/sudoers.d is world writable gives me this message and whenever i do sudo when I am using like normal user, it displays this message that it is world writable.
  • Krzysztof Stasiak
    Krzysztof Stasiak over 6 years
    Ok, one more idea;p do you have write perm to filesystem ( is not mounted as readonly)? Try chmod -v 644
  • jenny
    jenny over 6 years
    root@me-Latitude-E5550:/var/log# chmod -v 644 /etc/logrotate.conf mode of '/etc/logrotate.conf' changed from 0777 (rwxrwxrwx) to 0644 (rw-r--r--) root@me-Latitude-E5550:/var/log# ls -l /etc/logrotate.conf -rw-r--r-- 1 root root 703 Mai 6 2015 /etc/logrotate.conf yeah got the permissions.
  • jenny
    jenny over 6 years
    How can i change the permissions then? should i change it during boot? going to recover mode?
  • Krzysztof Stasiak
    Krzysztof Stasiak over 6 years
    You need to audit your /etc/ permissions, because there could be problem with other software, you may try to chmod o-rwx on files in etc, and lookbook into syslog for errors
  • Krzysztof Stasiak
    Krzysztof Stasiak over 6 years
    I dont knows about auto methods to reset permision, look [this] (askubuntu.com/questions/308939/…)
  • jenny
    jenny over 6 years
    root@me-Latitude-E5550:/var/log# gksudo chown root:root /etc/ root@me-Latitude-E5550:/var/log# gksudo chmod u+x /etc/ root@me-Latitude-E5550:/var/log# gksudo chmod a+r /etc/ root@me-Latitude-E5550:/var/log# ls -l /etc/logrotate.conf -rwxr-xr-x 1 root root 703 Mai 6 2015 /etc/logrotate.conf root@me-Latitude-E5550:/var/log# i think i got permissions as root user.
  • jenny
    jenny over 6 years
    ahh i got back my right permissions now... but when i run logrotate command it ` -rw-rw-r-- 1 root utmp 0 Jul 19 15:33 wtmp -rw-rw---- 1 root utmp 0 Jul 19 15:33 btmp drwxrwxr-x 13 root syslog 4,0K Jul 19 15:33 .` only these are becoming 0 others in /var/log aren't and Iam running out of system memory now.Can i delete log files manually? This logrotate isnt working
  • Krzysztof Stasiak
    Krzysztof Stasiak over 6 years
    You can delete logs manuały, i suggest to delete all .gz and with .1 files in /var/log that are old logs
  • user3821306
    user3821306 almost 6 years
    I had a file in logrotate.d that symlinked to a 664 config file... that needed changing to 644. all good now.