Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-03-2003, 07:08 AM   #1
LQ Newbie
Registered: Aug 2003
Distribution: Redhat 9.0
Posts: 14

Rep: Reputation: 0
Permission denied @ /var/log/mail

Hey guys, hope you can help me:

I have a shellscript which has a problem with mailing.

I post the whole stuff 'set -xv' prints out:

+ MAILLOGALL=/tmp/maillog.all
+ PATH=/var/log

trap "/bin/rm -f $TMPFOLDER/spamstat.$$; /bin/rm -f $MAILLOGALL" 0 1 2 3 15
+ trap '/bin/rm -f /tmp/spamstat.18857; /bin/rm -f /tmp/maillog.all' 0 1 2 3 15

/bin/touch $MAILLOGALL
+ /bin/touch /tmp/maillog.all
/bin/chmod 600 $MAILLOGALL
+ /bin/chmod 600 /tmp/maillog.all

/bin/cat $PATH/maillog.4 >> $MAILLOGALL
+ /bin/cat /var/log/maillog.4
/bin/cat $PATH/maillog.3 >> $MAILLOGALL
/bin/cat $PATH/maillog.2 >> $MAILLOGALL
/bin/cat $PATH/maillog.1 >> $MAILLOGALL
/bin/cat $PATH/maillog >> $MAILLOGALL

/usr/local/bin/spamstats -file $MAILLOGALL -number 10 -duration 2592000 > $TMPFOLDER/spamstat.$$
+ /usr/local/bin/spamstats -file /tmp/maillog.all -number 10 -duration 2592000

mail -s "Monthly spam statistic of 'hostname' " $TO < $TMPFOLDER/spamstat.$$
+ mail -s 'Monthly spam statistic of '\''hostname'\'' '
./email_spamstats_monthly30: line 23: /var/log/mail: Permission denied
/bin/rm -f /tmp/spamstat.18857; /bin/rm -f /tmp/maillog.all
+ /bin/rm -f /tmp/spamstat.18857
+ /bin/rm -f /tmp/maillog.all

If you need other information please tell me.
If I don't remove the spamstat.$$ an mail it manually I don't get problems...

Thanks in advance,


Last edited by Thorsten; 11-03-2003 at 07:10 AM.
Old 11-03-2003, 06:44 PM   #2
LQ Guru
Registered: Feb 2003
Location: Mineral, Virginia
Distribution: Debian 8
Posts: 7,893

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
I think that your problem is that you are using PATH as a variable when bash uses the PATH variable to find programs to run. Your script runs OK until you get to this statement:
mail -s "Monthly spam statistic of 'hostname' " $TO < $TMPFOLDER/spamstat.$$
Then bash goes to the directory /var/log and looks for an executable program called mail.
Whatever /var/log/mail might be, it is not an executable program so you get a permissions error.

I suggest that you rename your PATH variable to something that Linux does not use.

Be prepared. Create a LifeBoat CD.

Steve Stites


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Permission Denied when trying to delete /var robintw Linux - General 4 09-17-2005 02:00 PM
/var/log/messages - kernel: audit(1107868785.573:0): avc: denied { getattr } lothario Linux - Security 2 02-10-2005 04:24 AM
cps printing problem - /var/spool (permission denied) carboncopy Slackware 10 11-11-2004 03:28 AM
/var/log/news permission denied tt08 Linux - Newbie 4 10-30-2004 10:19 AM
HELP -- .forward.mail: Permission denied kepweng Linux - Software 1 04-16-2004 07:32 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:32 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration