Setting up Postfix to use an external mail server

Sometimes sending mail to a dev account is all well and good, but if the mail server you are sending to is not accepting the mail for one reason or another (disallowed dynamic ip addresses, for instance) then you might need to set it up to send through a mail server (relay).

I am using smtp.tatedavies.com as an example here, and the user “frank” with his password being “penguin” (clearly a very high security password)

Fire up terminal and sudo in.

sudo su
postconf -e "relayhost=smtp.tatedavies.com"
postconf -e "smtp_sasl_auth_enable=yes"
postconf -e "smtp_sasl_password_maps=hash:/etc/postfix/smtp_password"
echo "smtp.tatedavies.com frank:penguin" > /etc/postfix/smtp_password
chmod 600 /etc/postfix/smtp_password
postmap /etc/postfix/smtp_password
service postfix restart

Keeping 2 drives sync’ed with rsync on Linux

I have an external USB HDD and I like to keep it synchronised with my desktop for backup reasons. I find the easiest way to do this, is to use rsync:

> sudo apt-get install rsync
> rsync -avu /source/ /dest/

For example:

> rysnc -avu /media/externaldisk/ /home/chris/diskbackup/

Will increment copy everything (ignoring older files) from /media/externaldisk to my /home/chris/diskbackup folder.

The options are:

  • a – Archive mode – Will retain the folder/file properties, such as owner, permissions, etc.
  • v – Verbose – Output the progress to the screen (so I know its still working)
  • u – Update – Only update files that have a more recent file modified date.