Configure Postfix Relay

Configure Simple Relay

To configure the Linux server’s postfix software to relay mail to your SMTP server, open the postfix configuration file for editing:

vim /etc/postfix/main.cf

If your SMTP server allows relay without authentication, simply add the appropriate relayhost entry:

relayhost = exchange.customerdomain.com

Restart the postfix service to apply the settings change:

service postfix reload

Configure Relay with Authentication

Open the postfix configuration file for editing:

vim /etc/postfix/main.cf

If your SMTP server requires authentication (SMTP AUTH) and a secure connection (TLS), use the following procedure (which has been tested with Google Apps and Office365):

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_tls_security_level = may

Create a file where the credentials for SMTP AUTH will be stored:

vim /etc/postfix/sasl_passwd

Enter the credentials:

[smtp.gmail.com]:587 user@domain.com:password

Apply the settings:

postmap /etc/postfix/sasl_passwd
chmod 644 /etc/postfix/sasl_passwd
service postfix reload

Troubleshooting

Can’t Send Mail from Root

If your mail server requires that mail be sent from a valid address, you may have problems sending mail from the root account, which is required for backup reports and other purposes. In this case, create a mapping for the root user to a valid email address.

Add the following line to /etc/postfix/main.cf:

smtp_generic_maps = hash:/etc/postfix/generic

Add the required email address alias to /etc/postfix/generic:

root user@domain.com

Create the hash file and reload postfix:

postmap /etc/postfix/generic
service postfix reload

Vendor-Specific Notes

If you are having trouble sending outbound email with your mail server, you may refer to the hints below, or you may use a mail relay service like SendGrid.

Google

Please follow these instructions to configure postfix to relay via Google Apps or Gmail.

Microsoft Office365

Please follow these instructions to configure Office365 and postfix to work with your Eclipse server.

SendGrid

If you are having trouble with email relay using your mail server, we recommend using SendGrid.

How do I disable RHN emails?

To disable daily summary and errata emails from Red Hat Network:

Further resources:

How do I monitor disk usage via munin?

If your system has munin installed, you may review historical disk usage using the web interface:

  • Launch your web browser
  • Browse to your server’s munin directory (where 192.168.1.100 is the IP address of your Linux server): http://192.168.1.100/munin
  • Select your system’s hostname to bring up the detailed monitoring page
  • Select Disk Usage in Percent to view storage utilization trends
Here’s an example screenshot of the output, showing storage usage over time:

How Do I Change the Time on a Linux Server?

The command date -s <date or time string> will set the system time and/or date. Where <date or time string> should be enclosed in double-quotes (“) and describe the date and/or time that you would like to set.

For example:
date -s “31 OCT 2011 13:55:00”
This command needs to be run as root in order for it to work.

Example to set just the time:
date +%T -s 07:54:00

You can also use the plain date command to display the current system date and time.
Note, you must restart the system admin in order the system time change to be reflected in Eclipse.