LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-05-2022, 06:38 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,576

Rep: Reputation: 179Reputation: 179
Sendmail access.db permission denied


I have a sendmail alias pipe that catches messages to certain recipients and runs the email through a bash script.
Code:
test:           |" /user/util/bin/groupEmail test"
That groupEmail script runs sendmail:
Code:
cat "$msg" | /usr/sbin/sendmail -f${sendGridAuth} -t -oi -O NoRecipientAction=add-to-undisclosed
This works fine, but I want to use a different sendmail config for this bash script so I add a -C parameter:
Code:
cat "$msg" | /usr/sbin/sendmail -C/etc/mail/sendmail-sendgrid.cf -f${sendGridAuth} -t -oi -O NoRecipientAction=add-to-undisclosed
However, this gives me a warning and error:
Code:
Jun  6 09:43:26 mail sendmail[20336]: NOQUEUE: Authentication-Warning: mail.mercureytech.com: Processed by daemon with -C /etc/mail/sendmail-sendgrid.cf
Jun  6 09:43:26 mail sendmail[20336]: NOQUEUE: SYSERR(daemon): can not chdir(/var/spool/mqueue/): Permission denied
The message is not sent.

How do I overcome this?

Last edited by mfoley; 06-06-2022 at 08:52 AM.
 
Old 06-06-2022, 09:41 AM   #2
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,576

Original Poster
Rep: Reputation: 179Reputation: 179
OK - I found the solution to that problem: Sendmail Installation and Operation Guide > Arguments > Trying a Different Configuration File, https://www.sendmail.org/~ca/email/d...h-3.html#sh-3:
Quote:
Trying a Different Configuration File

An alternative configuration file can be specified using the -C flag; for example,

/usr/sbin/sendmail -Ctest.cf -oQ/tmp/mqueue

uses the configuration file test.cf instead of the default /etc/mail/sendmail.cf. If the -C flag has no value it defaults to sendmail.cf in the current directory.

Sendmail gives up set-user-ID root permissions (if it has been installed set-user-ID root) when you use this flag, so it is common to use a publicly writable directory (such as /tmp) as the queue directory (QueueDirectory or Q option) while testing.
That reveals a new problem:
Code:
Jun  6 10:27:34 mail sendmail[17601]: 256ERGe8017599: SYSERR(daemon): hash map "access": unsafe map file /etc/mail/access.db: Permission denied
I changed the permissions to 'chmod a+r /etc/mail/access.db' and that did remove that error, but that may not be the "best practice" way of solving that problem.

Thoughts?
 
Old 06-12-2022, 01:38 PM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,576

Original Poster
Rep: Reputation: 179Reputation: 179
I did get the technical problem solved, which I'll document here for the benefit of others.

Background: I have a groupEmail script on this mail server that is run by sendmail alias commands as shown in my OP:
Code:
test:           |" /user/util/bin/groupEmail test"
The groupEmail script would look up the members of e.g. "test" in the database, remove the To: line from the message, and place the looked-up email addresses in a Bcc line. That all worked fine except that in order to have the recipients' email server not get flooded with lots of email from one sender, the messages were sent one-by-one and spaced out at 3 minuted intervals. Not even gmail objected to that.

That could take a lot of time so the idea was to use a mail service like SendGrid to speed up this process by handing them all the messages is a much shorter timeframe. I subscribed the the SendGrid service, specified smtp.sendgrid.net as the system-wide SMART_HOST (relay). But ...

Problem #1 - SendGrid requires an authorized sender domain and none of the users sending email through this alias command script were local users. So, to solve problem 1 I further modified the groupEmail script to replace the From: address with an authorized domain sender (maillist@authdom.org), and put the original sender's email address in the Reply-To: line. And, most importantly, specified a different sendmail.cf config file using the -C option. Thus the groupEmail script would send specifying this special config which had the SendGrid SMART_HOST, but the rest of the normal email system would use a config script without the SendGrid relay. But ...

Problem #2 - This was the reason I posted this thread. When running Sendmail from an alias command with an alternate config file Sendmail gives up set-user-ID root permissions which means it cannot put messages in /var/spool/mqueue. As the article I reference in my #2 post, above, says, the solution to this is to specify a different mqueue folder with the -oQ option. I did this, but ...

Problem #3 - /etc/mail/access.db: Permission denied. This is because its permissions were -rw------- and it was owned by root. I solved that problem by changing its permissions to -rw-r--r--. But ...

Problem #4 - Nothing was sent, no messages in maillog. After scratching my head a while I reasoned that /etc/mail/authinfo.db also had these same ownership and permissions and perhaps the groupEmail script's sendmail could not read that file in order to authenticate with SendGrid. So, I changed it to also have -rw-r--r-- and that seemed to do the trick.

For good measure I also changed aliases.db and virtusertable.db to have -rw-r--r--. I could have probably accomplished the same by changing the group on these files to daemon and just adding group read access, but I didn't go there.

This all made the sendGrid relay implementation work. I had other problems with SendGrid actually being able to deliver these messages in a timely manner, but that's another story.

Last edited by mfoley; 06-12-2022 at 01:43 PM.
 
  


Reply

Tags
permissions, sendmail



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
[SOLVED] Execute permission set but permission denied when unlocking IronKey mdh524 Linux - Newbie 2 11-12-2015 09:36 PM
mkdir throws Permission Denied error in a directoy even with root ownership and 777 permission surajchalukya Linux - Security 14 09-03-2012 08:34 AM
du gives error : "du: cannot access `./.gvfs': Permission denied"du: cannot access `. MihirSahasrabudhe Linux - Security 4 12-29-2009 11:10 AM
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 04:50 AM
'permission denied" inspite of right permission flags on network drive anirudhvij Linux - Enterprise 8 05-22-2007 05:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:12 AM.

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