Re: How the average guy gets mail...
Andre Berger wrote:
>
> * Viktor Rosenfeld <rosenfel@informatik.hu-berlin.de>, 2001-05-10 02:36 +0200:
> > Hi Cameron,
> >
> > I second everything said so far on this thread, however, on a multi-user
> > system I would implement fetchmail-on-dialup in a slightly different
> > way.
> >
> > Create an /etc/fetchmail-users file with all the users that want to run
> > fetchmail
> >
> > ---8< snip >8---
> > # users that get mail by fetchmail
> > user_foo
> > user_bar
> > ---8< snip >8---
> >
> > Then create a ip-up script:
> >
> > #!/bin/bash
> >
> > if [ -f /etc/fetchmail-users ]; then
> > for user in `grep -v '^#' /etc/fetchmail-users`; do
> > if [ -f ~$user/.fetchmailrc ]; then
>
> This gives root control (and hassle) about everybody's mail.
Nope, you're wrong. I wrote the scripts above with the explicit goal,
that every user keeps control over his own ~/.fetchmailrc file, being
able to change passwords and host information etc. Root however has the
priviledge to allow which users have their mail automagically fetched on
dial-up. Hence the /etc/fetchmail-users file. As you can see, I check
for a ~$user/.fetchmailrc file (in the user's home directory) and the
`su` command below executes fetchmail with an EUID of the user.
> If you pass control to the users, you could do
>
> for i in $(ls /home/); do
> if [ -f /home/$i/.fetchmailrc ] && \
> [ -f /home/$i/email-addresses ]; then
>
> > su -c "fetchmail -d 900" $user
Which pretty much does the same thing as my code. Question: What is the
~/email-addresses file for?
> I'd recommend the "-k" option for an "official", the "-a" option for a
> "family box". "-k" means the mail stays on the server (because people might
> also want to have it at home), "-a" for a final destination (fetch all
> regardless).
I'd say, the best way to keep that information would be the
~/.fetchmailrc file of the user. So he can decide whether he wants to
keep or fetch all mail and can even differentiate on an account basis.
Cheers,
Viktor
--
Viktor Rosenfeld
WWW: http://www.informatik.hu-berlin.de/~rosenfel/
Reply to: