[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 563
  • Last Modified:


Redhat, /etc/mail/access

I am adding thousands of DISCARDs to /etc/mail/access.  Is it possible to have the access file reference external files.

For example, can I have:

From:[] OK
From:[] OK
File: /nas/companyA
File: /nas/companyB

This way, I need thousands of lines in /etc/mail/access
1 Solution
As far as I know, /etc/mail/access doesn't have the feature to reference external file.
Also, you need to use the makemap utility program to create the database map.
To create the access database map, use the following command:
# makemap hash /etc/mail/access.db < /etc/mail/access

For more details, check
not directly but the problem can be solved with DIY ;-)
follow this step
1) write your file as /etc/mail/access.my
2) write this simple script in /etc/mail/expAccessMy
echo "including single line"
grep -v "^File: " /etc/mail/access.my >/etc/mail/access
for name in `grep "^File: " /etc/mail/access.my | sed -e "s/^File: //"`
     echo "including file: $name"
     cat "$name" >>/etc/mail/access
makemap hash /etc/mail/access.db < /etc/mail/access

Open in new window

3) give the permission to the script (chmod +x /etc/mail/expMyAccess
4) execute the script (this step every time you modify the /etc/mail/access.my

N.B: if you have a valid content in /etc/mail/access, save it in another file (can be the starting point for access.my with "cp access access.my") before executing this script because it overwrite the /etc/mail/access evaluating the /etc/mail/access.my

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now