Invalid header: /var/log/rkhunter.log

I got the above error when I am executing the bash script with mail command.

In the scripts you use -a in the mail commands to attach the logfile. This does not function and results in an error that an invalid header is being added to the mail.

Looking in the documentation for the mail command, -a is used for adding headers, while -A is used for attaching files.

  -a, --append=HEADER: VALUE append given header to the message being sent
  -A, --attach=FILE          attach FILE

I was using “mail -s “REPORT – $HOSTNAME” -a $TMP_FILE abc@gmail.com and got the above error. Replaced -a with -A and executed the script. It has worked.

Also remember that it depends on the mail software which you are using. It likely depends on implementation, as these are different packages. If the script uses Heirloom-mailx, so -a is correct from that point of view. If you use some other software, just modify the script appropriately.

admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Comment

Scroll to Top