1

Good day

I'm using msmtp to send mails. I have different accounts that log to different logfiles. Unfortunately whenever it tries to log the following error appears:

send-mail: cannot log to /var/log/mail/[logfile].log: cannot open: Permission denied

I tried the following:

  • change owner/group of the file
  • tried 777 on the logfiles
  • edited the file as the user running the command (which worked)
  • disabled apparmor

Nothing has worked so far. I've run out of ideas... what am I doing wrong?

Thanks all for your help!

2
  • Classically you would set the location and name of the logfile in ~/.msmtprc, in a location that you have write access to and make sure the whole ~/.msmtprc file has the appropriate permission: chmod 600 ~/.msmtprc. Do you really need the log file away from $HOME?
    – andrew.46
    Feb 9, 2022 at 4:07
  • Thank you for your answer. Ideally I would like to have seperate logfiles because of the system we have set up with different clients. I know that the rights are ok, especially since I also tried 777.
    – silbro
    Feb 9, 2022 at 11:38

1 Answer 1

0

So the problem was still the apparmor. I didn't restart the server and so it didn't work as expected. I followed the instructions found here and excluded msmtp from apparmor. This solved the problem.

https://linuxconfig.org/how-to-disable-apparmor-on-ubuntu-20-04-focal-fossa-linux

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.