2

I have a user called admin (not root) and have setup everything under that user's account.

I have also crontab that is meant to run a bash script at a certain time in the day.

For some reason the script fails and the system is trying to email me. However there is no email setup for admin@mydomain.com. How can I change the default email address for this user to be something else than the domain name mydomain.com that is stored in /etc/mailname?

Sep 27 09:45:01 SAPI CRON[18430]: (admin) CMD (bash /home/admin/backup.sh XYZ)
Sep 27 09:45:04 SAPI pgbouncer[747]: stats: 0 xacts/s, 0 queries/s, in 0 B/s, out 0 B/s, xact 0 us, query 0 us, wait 0 us
Sep 27 09:45:47 SAPI postfix/pickup[18366]: 9FAB67DECE: uid=1000 from=<admin>
Sep 27 09:45:47 SAPI postfix/cleanup[18451]: 9FAB67DECE: message-id=<20220927094547.9FAB67DECE@sapi>
Sep 27 09:45:47 SAPI postfix/qmgr[18367]: 9FAB67DECE: from=<admin@mydomain.com>, size=2820, nrcpt=1 (queue active)
Sep 27 09:45:48 SAPI postfix/smtp[18453]: 9FAB67DECE: to=<admin@mydomain.com>, orig_to=<admin>, relay=email-smtp.eu-central-1.amazonaws.com[52.58.161.38]:587, delay=0.57, delays=0.02/0.04/0.31/0.2, dsn=2.0.0, status=sent (250 Ok)

1 Answer 1

1

To redirect emails for user admin to another email address or user, create an alias in /etc/aliases :

admin: user # For a local user mapping

or

admin: user@remote.com # For a remote user mapping

then update tour aliases DB with newaliases command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.