Operating System - HP-UX
1833717 Members
2321 Online
110063 Solutions
New Discussion

Forwarding Emails from Unix system

 
SOLVED
Go to solution
Ahmed M. AlShafiy
Regular Advisor

Forwarding Emails from Unix system

how can i make the mails that send to the HP-UX users like ( root - oracle - applmgr ) be automatic be forwarded to another email that i'm already can send mails from HP-UX to it with m command?
11 REPLIES 11
Oviwan
Honored Contributor

Re: Forwarding Emails from Unix system

Hi

for example in the root home-folder you can add your email-address in the .forward file.

Regards
Rick Garland
Honored Contributor
Solution

Re: Forwarding Emails from Unix system

You can set up aliases.

In the /etc/mail/aliases file you can have root aliased to 'you@yourdomain.com'

Same for oracvle and so forth.

Do issue the 'newaliases' command or the 'sendmail -bi' command to have the new aliases file read in.

Peter Godron
Honored Contributor

Re: Forwarding Emails from Unix system

Ahmed,
please also have a look at the /etc/aliases file, where you can specify where emails for specific events are sent.
After the changes, please run newaliases.
See man aliases for help.
Ahmed M. AlShafiy
Regular Advisor

Re: Forwarding Emails from Unix system

thr root-home-floder where i can find it ?

or where i can find .forward for any other users?
Rick Garland
Honored Contributor

Re: Forwarding Emails from Unix system

You would create the .forward file in the home directory of the respective user.

Example, in the $HOME for root, do the command
'touch .forward' and then you can vi the file and put the necessary info into the file.

Using the aliases file, you have only 1 file to manage. With the .forward files, you have a .forward file in the $HOME for each user you want to have forwarded mail. You have already listed 3 user accounts so you would have 3 .forward file to manage.
Oviwan
Honored Contributor

Re: Forwarding Emails from Unix system

standard root home is /

for the other users you create a .forward file in each home folder.

#cat .forward
email@bla.blubb
email2@bla.blubb

for more infos check also:
http://www.informatik.uni-frankfurt.de/doc/man/hpux/sendmail.1m.html

Regards
James R. Ferguson
Acclaimed Contributor

Re: Forwarding Emails from Unix system

Hi Ahmed:

As mentioned, creating a '.forward' file in the users $HOME directory (including root's) ia one way of setting up email forwarding.

Make sure, however, to keep the permissions of the '.forward' file writable *only* to its owner. To do otherwise is a security-hole.

If I can write to your '.forward' file then I can insert a script to run for whatever purpose I wish by doing:

| /tmp/mybadthing

The above line in your '.forward' file would cause my '/tmp/mybadthing' to run, which might not be a good thing :-))

Regards!

...JRF...
Geoff Wild
Honored Contributor

Re: Forwarding Emails from Unix system

IMHO - /etc/mail/aliases is the way to go.

I do something like this:

# Local aliases
root : sysadm
sysadm : gwild,user2
gwild : gwild@mydomain.ca
user2 : user2@mydomain.ca

Then just run the command newaliases

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Sam McKnight
Frequent Advisor

Re: Forwarding Emails from Unix system

If you haven't already, you should check your /etc/mail/aliases file to make sure you have defined all the aliases you need for system administration such as MAILER-DAEMON, postmaster, nobody, daemon, and webserv_adm.
Ahmed M. AlShafiy
Regular Advisor

Re: Forwarding Emails from Unix system

i don't find the file .forward
Ahmed M. AlShafiy
Regular Advisor

Re: Forwarding Emails from Unix system

Thanks All of you and i have do it with reconfiguring the ailases file.


but is't secure ?