Re: [SLUG] Masquerading as another user on boot

From: Scott Grizzard (scott@scottgrizzard.com)
Date: Sat Sep 05 2009 - 21:17:31 EDT


It is easier just to run fetchmail as a daemon, and let each user have
their own rcfethmail files. If you are using Ubuntu, I believe this is
the default. Instead of dumping to mail spools, deliver it to your mail
server (postfix in my case), and then you can run all sorts of spam
filters and antivirus too (which is probably what you are doing anyway).

Setting up a mailserver with Dovecot/Postfix/Procman is pretty easy in
Ubuntu and CentOS, and then run the fetchmail daemon and deliver it to
postfix.

What distro are you using?

- Scott Grizzard
http://www.scottgrizzard.com/

PS: Isn't fetchmail a no-no against POP3 servers, or was that problem
solved while I was doing something else?

Eben King wrote:
> On Mon, 10 Aug 2009, Paul M Foster wrote:
>
>> On Mon, Aug 10, 2009 at 10:45:48PM -0400, Chris Mathey wrote:
>>
>>> Paul M Foster wrote:
>>>> I just set up a centralized mailserver for our network. As
>>>> configured, a
>>>> fetchmail process runs as a daemon for each user. (Fetchmail run as a
>>>> single, central daemon dumps email into /var/mail/fetchmail, instead of
>>>> the individual spool files.) If I have to restart that system for some
>>>> reason, I'd like a way to restart the individual fetchmail daemons (all
>>>> two of them). But they run under the UID of the individual users who
>>>> issue the fetchmail command. Rather than having to ssh into that server
>>>> as each user and issue a fetchmail command, I'd like a way
>>>> (preferably a
>>>> script) which will lauch the two fetchmail instances as the individual
>>>> users without my intervention. I know, tall order.
>>>>
>>>> Any ideas?
>>>>
>>>>
>>> If you are running fetchamil in daemon mode then all you need is
>>> /etc/fetchmailrc. Add "poll" for each user.
>>> If a users wants to set up an individual one then they can create their
>>> own file in ~/
>>
>> Here's the problem: unless you use "multidrop mode", which is hairy and
>> which I don't fully understand, if you just run a central fetchmail
>> daemon, the mail dumps into /var/mail/fetchmail. What I need instead is
>> for mail for me to end up in /var/mail/paulf and mail for Nancy to end
>> up in /var/mail/nancyf. Hence the need for two separate user-launched
>> fetchmail daemons.
>
> First guess:
>
> /bin/foo:
> ,--
> | #! /bin/sh
> | for user in $(</var/bar) ; do
> | if [ -e ~"$user"/.fetchmail ] ; then
> | # whatever
> | else
> | sudo "$user" -c $FETCHMAIL_DAEMON_COMMAND_FOR_$user # & if required
> | fi
> | done
> '--
>
> /var/bar:
> ,--
> | user1
> | user2
> ...
> '--
>
> Run /bin/foo is root, say in /etc/rc.local.
>

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 13:28:01 EDT