0

I am new to managing a VPS. The host name for my vps is vps.techbreeze.in and recently I discovered that if i try to send a mail to an address like say rick@techbreeze.in the email gets sent to the /var/spool/mail/root However if I send an email to say another of my account, webmaster@cheap-webhosting.co.in the email goes to the inbox. How do I configure the emails to get sent to my inbox rather than the spool/mail/ The VPS I have doesn't have any dns configured runs on vhost and has one dedicated IP.

Rick Roy
  • 237
  • 1
  • 5
  • 15

1 Answers1

4

Typically a lot of scripts, cronjobs and such will generate output that gets send by email to the operator. The only garanteed operator account to exists on all Linux/Unix boxes is root, so that becomes the default mail recipient.

The same holds for email that bounces and can't get delivered.

Typically the administrator will configure the system to forward mail addressed to root to an user acount (locally or remote). The default is via /etc/aliases

# Basic system aliases -- these MUST be present.
mailer-daemon:  postmaster
postmaster:     root
# Forward all mail to root to Rick
root:           rick@techbreeze.in 

If your VPS comes with sendmail you need to run newaliases to activate the changes.

To route email you need DNS so start by confuguring DNS. Edit /etc/resolv.conf and add the following lines:

# /etc/resolv.conf
# Use Google's public DNS servers
nameserver 8.8.4.4
nameserver 8.8.8.8

Often this is already sufficient to send email.

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • Is there a good way to intercept these `root` mails? Since they are mostly notifications etc, I prefer they get forwarded out via webhooks/telegram etc – bilogic May 17 '23 at 02:09