So I've set chmod 777 -R to /var/log on Raspbian and now I get some errors when logrotate runs. The errors are like:

error: skipping "/var/log/apt/term.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

Is there a way to set it back to the default?

2 Answers 2


You can safely set perms to 755 for directories and 644 for file:

# find /var/log -type d -exec chmod 755 {} \;
# find /var/log -type f -exec chmod 644 {} \;

More secure (with access for root only):

# find /var/log -type d -exec chmod 700 {} \;
# find /var/log -type f -exec chmod 600 {} \;
  • 1
    Shorthand: chmod -R u=rwX,g=rX,o=rX /var/log, respectively chmod -R u=rwX,g=,o= /var/log. Nov 13, 2017 at 15:39

Files located in /var/log/ on raspbian have usually -rw-r----- permissions which means chmod 640 will put the correct permissions back.

For example, /var/log/apt/term.log has the following permissions set:

-rw-r----- 1 root adm      0 Nov  1 06:25 term.log

Other files under /var/log/ have the following permissions set:

-rw-r----- 1 root adm    214421 Nov 13 10:01 auth.log
-rw-r----- 1 root adm  16903470 Nov 12 06:25 auth.log.1

To set the correct permissions on these files use find as follows:

find /var/log/ -type f -exec chmod 640 {} +

For directories, you can use this:

find /var/log -type d -exec chmod 755 {} +

The command find will walk through the /var/log directory and based on the type you pass to it, correct permissions are applied.

  • The result of the command is find: Arguments to -type should contain only one letter but it helped a lot. Thanks!
    – sOnt
    Nov 13, 2017 at 9:38
  • @sOnt I saw I had an extra - there as -f but corrected it. Glad it helped you Nov 13, 2017 at 10:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .