On 02/04/14 00:27, Simon Drewitz wrote: > Hi misc@, > > I have set up mail(1) so that it forwards mails such as the output of > /etc/daily to my mail account and now I want to encrypt these mails > using my public gpg-key. The best solution I have come up with is > changing these two lines at the end of /etc/daily: > > - } 2>&1 | mail -s "`hostname` daily output" root > + } 2>&1 | gpg2 --encrypt -r <key-ID> --armor | mail -s "`hostname` daily > output" root > > ... > > - [ -s $MAINOUT ] && mail -s "`hostname` daily insecurity output" root < > $MAINOUT > + [ -s $MAINOUT ] && gpg2 --encrypt -r <key-ID> --armor < $MAINOUT | mail -s > "`hostname` daily insecurity output" root > > While it perfectly does what I want, I consider it bad habit to change > /etc/daily itself and would like to know if there is any preferred > solution to this issue?
I don't know about preferred, but I believe adding this to daily.local would also solve your issue (and leave other mail to root untouched): mail() { gpg2 --encrypt -r <key-ID> --armor | /usr/bin/mail "$@" } /Alexander > > Thanks in advance > Simon