Can I change root's email address or forward it to an external address?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
55
down vote

favorite
17












I'm getting a lot of mail in my root user's mail account. This appears to be mostly reports and errors from things like cron scripts. I'm trying to work though and solve these things, possibly even have them be piped to some sort of "dashboard" - but until then how can I have these messages go to my personal e-mail account instead?










share|improve this question























  • You should ask your second question as a separate question if you really want an answer to it.
    – cjm
    Dec 13 '11 at 8:40














up vote
55
down vote

favorite
17












I'm getting a lot of mail in my root user's mail account. This appears to be mostly reports and errors from things like cron scripts. I'm trying to work though and solve these things, possibly even have them be piped to some sort of "dashboard" - but until then how can I have these messages go to my personal e-mail account instead?










share|improve this question























  • You should ask your second question as a separate question if you really want an answer to it.
    – cjm
    Dec 13 '11 at 8:40












up vote
55
down vote

favorite
17









up vote
55
down vote

favorite
17






17





I'm getting a lot of mail in my root user's mail account. This appears to be mostly reports and errors from things like cron scripts. I'm trying to work though and solve these things, possibly even have them be piped to some sort of "dashboard" - but until then how can I have these messages go to my personal e-mail account instead?










share|improve this question















I'm getting a lot of mail in my root user's mail account. This appears to be mostly reports and errors from things like cron scripts. I'm trying to work though and solve these things, possibly even have them be piped to some sort of "dashboard" - but until then how can I have these messages go to my personal e-mail account instead?







email root monitoring mail-transport-agent






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 4 '13 at 21:37









Gilles

517k12410321561




517k12410321561










asked Dec 13 '11 at 0:00









cwd

13.1k52114156




13.1k52114156











  • You should ask your second question as a separate question if you really want an answer to it.
    – cjm
    Dec 13 '11 at 8:40
















  • You should ask your second question as a separate question if you really want an answer to it.
    – cjm
    Dec 13 '11 at 8:40















You should ask your second question as a separate question if you really want an answer to it.
– cjm
Dec 13 '11 at 8:40




You should ask your second question as a separate question if you really want an answer to it.
– cjm
Dec 13 '11 at 8:40










5 Answers
5






active

oldest

votes

















up vote
65
down vote



accepted










Any user, including root, can forward their local email by putting the forwarding address in a file called ~/.forward. You can have multiple addresses there, all on one line and separated by comma. If you want both local delivery and forwarding, put root@localhost as one of the addresses.



The system administrator can define email aliases in the file /etc/aliases. This file contains lines like root: cwd@mailhost.example.com, /root/mailbox; the effect is the same as having cwd@mailhost.example.com, /root/mailbox in ~root/.forward. You may need to run a program such as newaliases after changing /etc/aliases.



Note that the workings of .forward and /etc/aliases depend on your MTA. Most MTAs implement the main features provided by the traditional sendmail, but check your MTA's documentation.






share|improve this answer




















  • hmm, does cwd@mailhost.example.com, /root/mailbox work on ubuntu? it goes to the first address but not the local mailbox for root, even after running newaliases. I also tried /var/mail/root without success...
    – cwd
    Dec 14 '11 at 1:37






  • 1




    @cwd It does for Postfix. Hmm, I think recent versions of Ubuntu install a limited MTA which doesn't do any local delivery in the default desktop installation. Older Ubuntu releases or server installations install Postfix by default, and Postfix does support my examples.
    – Gilles
    Dec 14 '11 at 10:07










  • Thanks. I think root's .forward file may have been overriding the multiple addresses I had in the alias file. It's working now, thanks for your help :)
    – cwd
    Dec 14 '11 at 14:20










  • What permissions should the file have?
    – Thomas Weller
    Nov 30 '15 at 21:59










  • @ThomasWeller Which file? /etc/aliases and ~/.forward are usually 644, though I think 600 works with most MTAs.
    – Gilles
    Nov 30 '15 at 22:09

















up vote
12
down vote













Simply create /root/.forward and place your email address in this file. It will be forwarded to your external mail address.






share|improve this answer



























    up vote
    1
    down vote













    in .forward myaddress@example.com, root@thisserver.com



    with this I get an email on my box and it is also written to /var/mail/root. (my distribution is debian with postfix) Replace "thisserver.com" with the domain name of your server






    share|improve this answer



























      up vote
      0
      down vote













      Use this command:



      nano /root/.forward 


      Insert, edit or remove emails in that text file, Ctrl+X, [Y] to save file.






      share|improve this answer





























        up vote
        0
        down vote













        If you are using the Postfix MTA and own your own domain (example.com), you can configure it to forward to root@example.com alongside any other user account.



        In the main.cf configuration file, or with the overrides in master.cf set the following options:



        mydomain = example.com
        mydestination = localhost.localdomain, localhost, local.$mydomain # Basically, anything but $mydomain


        This will have Postfix treat mail to your root account as root@example.com and route it accordingly, whether relay to your relayhost or deliver it to example.com directly. With this configuration Postfix will deliver mail to root@local.example.com to your local mailbox (/var/mail/root or wherever your system delivers system mail).





        share




















          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f26666%2fcan-i-change-roots-email-address-or-forward-it-to-an-external-address%23new-answer', 'question_page');

          );

          Post as a guest






























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          65
          down vote



          accepted










          Any user, including root, can forward their local email by putting the forwarding address in a file called ~/.forward. You can have multiple addresses there, all on one line and separated by comma. If you want both local delivery and forwarding, put root@localhost as one of the addresses.



          The system administrator can define email aliases in the file /etc/aliases. This file contains lines like root: cwd@mailhost.example.com, /root/mailbox; the effect is the same as having cwd@mailhost.example.com, /root/mailbox in ~root/.forward. You may need to run a program such as newaliases after changing /etc/aliases.



          Note that the workings of .forward and /etc/aliases depend on your MTA. Most MTAs implement the main features provided by the traditional sendmail, but check your MTA's documentation.






          share|improve this answer




















          • hmm, does cwd@mailhost.example.com, /root/mailbox work on ubuntu? it goes to the first address but not the local mailbox for root, even after running newaliases. I also tried /var/mail/root without success...
            – cwd
            Dec 14 '11 at 1:37






          • 1




            @cwd It does for Postfix. Hmm, I think recent versions of Ubuntu install a limited MTA which doesn't do any local delivery in the default desktop installation. Older Ubuntu releases or server installations install Postfix by default, and Postfix does support my examples.
            – Gilles
            Dec 14 '11 at 10:07










          • Thanks. I think root's .forward file may have been overriding the multiple addresses I had in the alias file. It's working now, thanks for your help :)
            – cwd
            Dec 14 '11 at 14:20










          • What permissions should the file have?
            – Thomas Weller
            Nov 30 '15 at 21:59










          • @ThomasWeller Which file? /etc/aliases and ~/.forward are usually 644, though I think 600 works with most MTAs.
            – Gilles
            Nov 30 '15 at 22:09














          up vote
          65
          down vote



          accepted










          Any user, including root, can forward their local email by putting the forwarding address in a file called ~/.forward. You can have multiple addresses there, all on one line and separated by comma. If you want both local delivery and forwarding, put root@localhost as one of the addresses.



          The system administrator can define email aliases in the file /etc/aliases. This file contains lines like root: cwd@mailhost.example.com, /root/mailbox; the effect is the same as having cwd@mailhost.example.com, /root/mailbox in ~root/.forward. You may need to run a program such as newaliases after changing /etc/aliases.



          Note that the workings of .forward and /etc/aliases depend on your MTA. Most MTAs implement the main features provided by the traditional sendmail, but check your MTA's documentation.






          share|improve this answer




















          • hmm, does cwd@mailhost.example.com, /root/mailbox work on ubuntu? it goes to the first address but not the local mailbox for root, even after running newaliases. I also tried /var/mail/root without success...
            – cwd
            Dec 14 '11 at 1:37






          • 1




            @cwd It does for Postfix. Hmm, I think recent versions of Ubuntu install a limited MTA which doesn't do any local delivery in the default desktop installation. Older Ubuntu releases or server installations install Postfix by default, and Postfix does support my examples.
            – Gilles
            Dec 14 '11 at 10:07










          • Thanks. I think root's .forward file may have been overriding the multiple addresses I had in the alias file. It's working now, thanks for your help :)
            – cwd
            Dec 14 '11 at 14:20










          • What permissions should the file have?
            – Thomas Weller
            Nov 30 '15 at 21:59










          • @ThomasWeller Which file? /etc/aliases and ~/.forward are usually 644, though I think 600 works with most MTAs.
            – Gilles
            Nov 30 '15 at 22:09












          up vote
          65
          down vote



          accepted







          up vote
          65
          down vote



          accepted






          Any user, including root, can forward their local email by putting the forwarding address in a file called ~/.forward. You can have multiple addresses there, all on one line and separated by comma. If you want both local delivery and forwarding, put root@localhost as one of the addresses.



          The system administrator can define email aliases in the file /etc/aliases. This file contains lines like root: cwd@mailhost.example.com, /root/mailbox; the effect is the same as having cwd@mailhost.example.com, /root/mailbox in ~root/.forward. You may need to run a program such as newaliases after changing /etc/aliases.



          Note that the workings of .forward and /etc/aliases depend on your MTA. Most MTAs implement the main features provided by the traditional sendmail, but check your MTA's documentation.






          share|improve this answer












          Any user, including root, can forward their local email by putting the forwarding address in a file called ~/.forward. You can have multiple addresses there, all on one line and separated by comma. If you want both local delivery and forwarding, put root@localhost as one of the addresses.



          The system administrator can define email aliases in the file /etc/aliases. This file contains lines like root: cwd@mailhost.example.com, /root/mailbox; the effect is the same as having cwd@mailhost.example.com, /root/mailbox in ~root/.forward. You may need to run a program such as newaliases after changing /etc/aliases.



          Note that the workings of .forward and /etc/aliases depend on your MTA. Most MTAs implement the main features provided by the traditional sendmail, but check your MTA's documentation.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 13 '11 at 0:20









          Gilles

          517k12410321561




          517k12410321561











          • hmm, does cwd@mailhost.example.com, /root/mailbox work on ubuntu? it goes to the first address but not the local mailbox for root, even after running newaliases. I also tried /var/mail/root without success...
            – cwd
            Dec 14 '11 at 1:37






          • 1




            @cwd It does for Postfix. Hmm, I think recent versions of Ubuntu install a limited MTA which doesn't do any local delivery in the default desktop installation. Older Ubuntu releases or server installations install Postfix by default, and Postfix does support my examples.
            – Gilles
            Dec 14 '11 at 10:07










          • Thanks. I think root's .forward file may have been overriding the multiple addresses I had in the alias file. It's working now, thanks for your help :)
            – cwd
            Dec 14 '11 at 14:20










          • What permissions should the file have?
            – Thomas Weller
            Nov 30 '15 at 21:59










          • @ThomasWeller Which file? /etc/aliases and ~/.forward are usually 644, though I think 600 works with most MTAs.
            – Gilles
            Nov 30 '15 at 22:09
















          • hmm, does cwd@mailhost.example.com, /root/mailbox work on ubuntu? it goes to the first address but not the local mailbox for root, even after running newaliases. I also tried /var/mail/root without success...
            – cwd
            Dec 14 '11 at 1:37






          • 1




            @cwd It does for Postfix. Hmm, I think recent versions of Ubuntu install a limited MTA which doesn't do any local delivery in the default desktop installation. Older Ubuntu releases or server installations install Postfix by default, and Postfix does support my examples.
            – Gilles
            Dec 14 '11 at 10:07










          • Thanks. I think root's .forward file may have been overriding the multiple addresses I had in the alias file. It's working now, thanks for your help :)
            – cwd
            Dec 14 '11 at 14:20










          • What permissions should the file have?
            – Thomas Weller
            Nov 30 '15 at 21:59










          • @ThomasWeller Which file? /etc/aliases and ~/.forward are usually 644, though I think 600 works with most MTAs.
            – Gilles
            Nov 30 '15 at 22:09















          hmm, does cwd@mailhost.example.com, /root/mailbox work on ubuntu? it goes to the first address but not the local mailbox for root, even after running newaliases. I also tried /var/mail/root without success...
          – cwd
          Dec 14 '11 at 1:37




          hmm, does cwd@mailhost.example.com, /root/mailbox work on ubuntu? it goes to the first address but not the local mailbox for root, even after running newaliases. I also tried /var/mail/root without success...
          – cwd
          Dec 14 '11 at 1:37




          1




          1




          @cwd It does for Postfix. Hmm, I think recent versions of Ubuntu install a limited MTA which doesn't do any local delivery in the default desktop installation. Older Ubuntu releases or server installations install Postfix by default, and Postfix does support my examples.
          – Gilles
          Dec 14 '11 at 10:07




          @cwd It does for Postfix. Hmm, I think recent versions of Ubuntu install a limited MTA which doesn't do any local delivery in the default desktop installation. Older Ubuntu releases or server installations install Postfix by default, and Postfix does support my examples.
          – Gilles
          Dec 14 '11 at 10:07












          Thanks. I think root's .forward file may have been overriding the multiple addresses I had in the alias file. It's working now, thanks for your help :)
          – cwd
          Dec 14 '11 at 14:20




          Thanks. I think root's .forward file may have been overriding the multiple addresses I had in the alias file. It's working now, thanks for your help :)
          – cwd
          Dec 14 '11 at 14:20












          What permissions should the file have?
          – Thomas Weller
          Nov 30 '15 at 21:59




          What permissions should the file have?
          – Thomas Weller
          Nov 30 '15 at 21:59












          @ThomasWeller Which file? /etc/aliases and ~/.forward are usually 644, though I think 600 works with most MTAs.
          – Gilles
          Nov 30 '15 at 22:09




          @ThomasWeller Which file? /etc/aliases and ~/.forward are usually 644, though I think 600 works with most MTAs.
          – Gilles
          Nov 30 '15 at 22:09












          up vote
          12
          down vote













          Simply create /root/.forward and place your email address in this file. It will be forwarded to your external mail address.






          share|improve this answer
























            up vote
            12
            down vote













            Simply create /root/.forward and place your email address in this file. It will be forwarded to your external mail address.






            share|improve this answer






















              up vote
              12
              down vote










              up vote
              12
              down vote









              Simply create /root/.forward and place your email address in this file. It will be forwarded to your external mail address.






              share|improve this answer












              Simply create /root/.forward and place your email address in this file. It will be forwarded to your external mail address.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Dec 13 '11 at 0:12







              user11780



























                  up vote
                  1
                  down vote













                  in .forward myaddress@example.com, root@thisserver.com



                  with this I get an email on my box and it is also written to /var/mail/root. (my distribution is debian with postfix) Replace "thisserver.com" with the domain name of your server






                  share|improve this answer
























                    up vote
                    1
                    down vote













                    in .forward myaddress@example.com, root@thisserver.com



                    with this I get an email on my box and it is also written to /var/mail/root. (my distribution is debian with postfix) Replace "thisserver.com" with the domain name of your server






                    share|improve this answer






















                      up vote
                      1
                      down vote










                      up vote
                      1
                      down vote









                      in .forward myaddress@example.com, root@thisserver.com



                      with this I get an email on my box and it is also written to /var/mail/root. (my distribution is debian with postfix) Replace "thisserver.com" with the domain name of your server






                      share|improve this answer












                      in .forward myaddress@example.com, root@thisserver.com



                      with this I get an email on my box and it is also written to /var/mail/root. (my distribution is debian with postfix) Replace "thisserver.com" with the domain name of your server







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Mar 26 '13 at 8:48









                      Kawa600

                      111




                      111




















                          up vote
                          0
                          down vote













                          Use this command:



                          nano /root/.forward 


                          Insert, edit or remove emails in that text file, Ctrl+X, [Y] to save file.






                          share|improve this answer


























                            up vote
                            0
                            down vote













                            Use this command:



                            nano /root/.forward 


                            Insert, edit or remove emails in that text file, Ctrl+X, [Y] to save file.






                            share|improve this answer
























                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              Use this command:



                              nano /root/.forward 


                              Insert, edit or remove emails in that text file, Ctrl+X, [Y] to save file.






                              share|improve this answer














                              Use this command:



                              nano /root/.forward 


                              Insert, edit or remove emails in that text file, Ctrl+X, [Y] to save file.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Nov 29 '15 at 10:26









                              G-Man

                              12.2k92860




                              12.2k92860










                              answered Nov 29 '15 at 8:49









                              Dylan B

                              1412




                              1412




















                                  up vote
                                  0
                                  down vote













                                  If you are using the Postfix MTA and own your own domain (example.com), you can configure it to forward to root@example.com alongside any other user account.



                                  In the main.cf configuration file, or with the overrides in master.cf set the following options:



                                  mydomain = example.com
                                  mydestination = localhost.localdomain, localhost, local.$mydomain # Basically, anything but $mydomain


                                  This will have Postfix treat mail to your root account as root@example.com and route it accordingly, whether relay to your relayhost or deliver it to example.com directly. With this configuration Postfix will deliver mail to root@local.example.com to your local mailbox (/var/mail/root or wherever your system delivers system mail).





                                  share
























                                    up vote
                                    0
                                    down vote













                                    If you are using the Postfix MTA and own your own domain (example.com), you can configure it to forward to root@example.com alongside any other user account.



                                    In the main.cf configuration file, or with the overrides in master.cf set the following options:



                                    mydomain = example.com
                                    mydestination = localhost.localdomain, localhost, local.$mydomain # Basically, anything but $mydomain


                                    This will have Postfix treat mail to your root account as root@example.com and route it accordingly, whether relay to your relayhost or deliver it to example.com directly. With this configuration Postfix will deliver mail to root@local.example.com to your local mailbox (/var/mail/root or wherever your system delivers system mail).





                                    share






















                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      If you are using the Postfix MTA and own your own domain (example.com), you can configure it to forward to root@example.com alongside any other user account.



                                      In the main.cf configuration file, or with the overrides in master.cf set the following options:



                                      mydomain = example.com
                                      mydestination = localhost.localdomain, localhost, local.$mydomain # Basically, anything but $mydomain


                                      This will have Postfix treat mail to your root account as root@example.com and route it accordingly, whether relay to your relayhost or deliver it to example.com directly. With this configuration Postfix will deliver mail to root@local.example.com to your local mailbox (/var/mail/root or wherever your system delivers system mail).





                                      share












                                      If you are using the Postfix MTA and own your own domain (example.com), you can configure it to forward to root@example.com alongside any other user account.



                                      In the main.cf configuration file, or with the overrides in master.cf set the following options:



                                      mydomain = example.com
                                      mydestination = localhost.localdomain, localhost, local.$mydomain # Basically, anything but $mydomain


                                      This will have Postfix treat mail to your root account as root@example.com and route it accordingly, whether relay to your relayhost or deliver it to example.com directly. With this configuration Postfix will deliver mail to root@local.example.com to your local mailbox (/var/mail/root or wherever your system delivers system mail).






                                      share











                                      share


                                      share










                                      answered 4 mins ago









                                      palswim

                                      1,31611629




                                      1,31611629



























                                           

                                          draft saved


                                          draft discarded















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f26666%2fcan-i-change-roots-email-address-or-forward-it-to-an-external-address%23new-answer', 'question_page');

                                          );

                                          Post as a guest













































































                                          Popular posts from this blog

                                          How to check contact read email or not when send email to Individual?

                                          Bahrain

                                          Postfix configuration issue with fips on centos 7; mailgun relay