Log File Rotation: Permission Denied

This is the area for a general support questions, discussions and information that you can read and share. Post your experiences, stats and tricks and tips that are not covered elsewhere. Remember, for questions please search the FAQ first, as your question may already be answered.

Moderators: wizard, magicspam

Post Reply
chrismcb
Posts: 14
Joined: Tue Sep 28, 2010 9:26 am

Log File Rotation: Permission Denied

Post by chrismcb » Sat Dec 04, 2010 4:15 am

Hi,

I'm having nightly emails at 00:00 regarding magic spam trying to rotate its log files:

Code: Select all

mv: cannot move `/var/log/magicspam/mslog' to `/var/log/magicspam/mslog.1': Permission denied
I have manually moved them around, but the permissions are set as:

Code: Select all

# ls -la
total 9560
drwxr-xr-x  2 magicspam magicspam    4096 Dec  4 11:08 .
drwxr-xr-x 23 root      root         4096 Dec  4 06:12 ..
-rw-r--r--  1 magicspam magicspam     500 Nov 30 23:59 .counter.dat.11
-rw-r--r--  1 magicspam magicspam     500 Dec  4 11:12 .counter.dat.12
-rw-r--r--  1 magicspam magicspam    3515 Dec  4 11:12 mslog
-rw-r--r--  1 magicspam magicspam 4570201 Dec  4 11:07 mslog.1
-rw-r--r--  1 magicspam magicspam 5166520 Dec  1 09:34 mslog.2
The email alert is coming from:

Code: Select all

Cron <qmaild@xxxxxx> /usr/share/magicspam/bin/rotate_logs /var/log/magicspam/mslog
I have not altered any cron tasks.

Should this task be running as qmaild? Is there anything else i should be looking at?



Thanks

magicspam
Posts: 1563
Joined: Tue Oct 28, 2008 2:27 pm

Re: Log File Rotation: Permission Denied

Post by magicspam » Mon Dec 06, 2010 9:49 am

Hello Chris,

Did you recently change MTA backends on your Plesk Backend to/from Postfix / Qmail ? What is the active MTA you are running now?

It should be noted that for the QMail MTA backend, you will need to ensure that the contents of /var/log/magicspam (including the directory itself) should have the ownership:

qmaild:qmail

Whereas the Postfix MTA will require the ownership:

magicspam:magicspam

chrismcb
Posts: 14
Joined: Tue Sep 28, 2010 9:26 am

Re: Log File Rotation: Permission Denied

Post by chrismcb » Thu Dec 09, 2010 1:42 am

Sorry, forogot to return here to check for replies - I assumed I'd get an email alerting me (any chance you can enable this feature please?).

I did have to change from Postfix to Qmail back to Postfix to fix something in Plesk, however all permissions are set correctly.

I currently use Postfix and /var/log/magicspam has the ownership magicspam:magicspam as does all of its contents.


It is able to write to the logs, just not rotate them.


Anything else I should check?

magicspam
Posts: 1563
Joined: Tue Oct 28, 2008 2:27 pm

Re: Log File Rotation: Permission Denied

Post by magicspam » Thu Dec 09, 2010 11:15 am

Would you be able to check the file:

/etc/cron.d/magicspam-update

and check the user that the job /usr/share/magicspam/bin/rotate_logs is set to run as? If it is set to 'qmaild' then changing that to 'magicspam' should resolve this issue. We have raised this topic to our packaging team as well to ensure that the rotation cron is updated properly in the future.

Thanks!

chrismcb
Posts: 14
Joined: Tue Sep 28, 2010 9:26 am

Re: Log File Rotation: Permission Denied

Post by chrismcb » Fri Dec 10, 2010 3:53 am

Thanks.

Both files you asked me to check were set as root:root.

I've set them both to magicspam:magicspam now and will let you know tomorrow once it's had time to run through.

chrismcb
Posts: 14
Joined: Tue Sep 28, 2010 9:26 am

Re: Log File Rotation: Permission Denied

Post by chrismcb » Fri Dec 10, 2010 3:54 am

Out of curiosity, should all files in /usr/share/magicspam/bin be ownd by magicspam:magicspam?

All of mine are currently root:root.

chrismcb
Posts: 14
Joined: Tue Sep 28, 2010 9:26 am

Re: Log File Rotation: Permission Denied

Post by chrismcb » Fri Dec 10, 2010 3:56 am

Totally misread that, sorry...

Checked contents of /etc/cron.d/magicspam-update and the user was set to qmaild.

I've now set it to magicspam.

magicspam
Posts: 1563
Joined: Tue Oct 28, 2008 2:27 pm

Re: Log File Rotation: Permission Denied

Post by magicspam » Fri Dec 10, 2010 12:34 pm

It sounds like you have the problem licked, and our development team has confirmed that the package updates will now ensure the settings for cases where MTA compatibility packages are swapped out.

To answer your question regarding the files in /usr/share/magicspam , root:root ownership is normal. It is just the configuration files primarily located in /etc/magicspam and the log files in /var/log/magicspam that will have different 'special' ownership based on the backend MTA integration.

chrismcb
Posts: 14
Joined: Tue Sep 28, 2010 9:26 am

Re: Log File Rotation: Permission Denied

Post by chrismcb » Sat Dec 11, 2010 2:01 am

Thanks - I can confirm it worked as expected overnight.

I am, though, having one last error show up in logs - probably related:

Code: Select all

magicspam[15072]: Failed to fetch entire file [37] from http://mirror1.bms.linuxmagic.com/bms_updates/ 

magicspam
Posts: 1563
Joined: Tue Oct 28, 2008 2:27 pm

Re: Log File Rotation: Permission Denied

Post by magicspam » Mon Dec 13, 2010 9:44 am

Hello Chris,

This would appear to be a case of the IP Reputation list updates failing to retrieve the entirety of a download. This may be related to network timeout, DNS errors, or any other of a number of network related items.

Can you confirm that there are files in /var/cache/bms as well as the time stamps associated? (ls -al /var/cache/bms)

Post Reply

Return to “General Discussions and Support Questions”

Who is online

Users browsing this forum: Bing [Bot] and 4 guests