Users can redirect mail addressed to themselves by creating a file named
.forward in their home directory
(see §25.7).
(The ForwardPath
option is used to change or augment
the location and name of the .forward file.)
The .forward file must be owned by the user or by root,
and must not be world writable (mode 644 is recommended).
Entries read:
member1, member2, ...
There can be multiple lines,
but they are treated independently
(there are no continuation lines).
Just as in the aliases file, members
may be a user address, a file name,
a program reference,
or a :include:
reference.
Files must be writable by the forwarding user,
programs are run as the forwarding user,
and :include:
files must be readable by the forwarding user.
The ability to run progams or to write to files from the .forward file is controlled by the /etc/shells file. If the owner of the .forward file lacks a valid shell as listed in /etc/shells, program execution is disallowed. The special string /SENDMAIL/ANY/SHELL/, when placed in the /etc/shells file, allows all users to execute programs and deliver to files (see §18.8.56).