Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[WORKAROUND] Mail permissions not right (not solved yet)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Gentoo-Ed
Guru
Guru


Joined: 21 Apr 2005
Posts: 442
Location: the Netherlands

PostPosted: Sun Feb 25, 2007 9:07 am    Post subject: [WORKAROUND] Mail permissions not right (not solved yet) Reply with quote

I 'm having a problem with my procmail setting wrong permissions. I have a workaround which I want to run as soon as procmail has run.

The command which needs to be run is something like CHMOD -R 777 ...

How do I do this?

Further down it's adviced to use UMASK. But how to do that


Last edited by Gentoo-Ed on Sat Mar 03, 2007 10:23 am; edited 3 times in total
Back to top
View user's profile Send private message
grimm26
Guru
Guru


Joined: 23 May 2004
Posts: 313
Location: Chicagoland, IL

PostPosted: Mon Feb 26, 2007 4:35 am    Post subject: Reply with quote

You do not want to do that. I would suggest reading up on umask instead.
_________________
"Blessed is he who finds happiness in his own foolishness, for he will always be happy".
Back to top
View user's profile Send private message
Gentoo-Ed
Guru
Guru


Joined: 21 Apr 2005
Posts: 442
Location: the Netherlands

PostPosted: Mon Feb 26, 2007 12:57 pm    Post subject: Reply with quote

Thanks. I'll do at. What I quickly read is that the new files will be created and then when a user "touches" them they can open them. So I'll have to figure out how fdisk/procmail is to be used running with UMASK
Back to top
View user's profile Send private message
Gentoo-Ed
Guru
Guru


Joined: 21 Apr 2005
Posts: 442
Location: the Netherlands

PostPosted: Thu Mar 01, 2007 6:18 am    Post subject: Reply with quote

I've tried adding umask to the command in my /etc/ini.t/fetchmail where I added procmail but that doesn't work. So I have to figure out where it will work.
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Fri Mar 02, 2007 5:07 am    Post subject: Reply with quote

Moved from Other Things Gentoo to Networking & Security.
Back to top
View user's profile Send private message
Gentoo-Ed
Guru
Guru


Joined: 21 Apr 2005
Posts: 442
Location: the Netherlands

PostPosted: Fri Mar 02, 2007 2:33 pm    Post subject: Reply with quote

Can anyone help with UMASK????
Back to top
View user's profile Send private message
grimm26
Guru
Guru


Joined: 23 May 2004
Posts: 313
Location: Chicagoland, IL

PostPosted: Fri Mar 02, 2007 2:50 pm    Post subject: Reply with quote

from the procmailrc man page:
Quote:

UMASK
The name says it all (if it doesnât, then forget about this
one :-). Anything assigned to UMASK is taken as an octal
number. If not specified, the umask defaults to 077. If
the umask permits o+x, all the mailboxes procmail delivers
to directly will receive an o+x mode change. This can be
used to check if new mail arrived.


So, just set UMASK to whatever you want in your /etc/procmailrc or ~/.procmailrc
Anyway, why do you want a mailbox with group and/or other permissions?
_________________
"Blessed is he who finds happiness in his own foolishness, for he will always be happy".
Back to top
View user's profile Send private message
Gentoo-Ed
Guru
Guru


Joined: 21 Apr 2005
Posts: 442
Location: the Netherlands

PostPosted: Sat Mar 03, 2007 9:26 am    Post subject: Reply with quote

This is as a workaround

When my mail is fetched with fetchmail (starting at startup) it's filtered by procmail. See my /etc/init.d/fetchmail
Code:
start() {
        checkconfig || return 1

        ebegin "Starting fetchmail"
        start-stop-daemon --start --quiet --exec /usr/bin/fetchmail \
                -- -d ${polling_period} -f /etc/fetchmailrc \
                -m "/usr/bin/procmail -d %T"
        eend ${?}
}

Then /etc/procmail says:
Code:
DROPPRIVS=y
SHELL=/bin/sh

INCLUDERC=/storage/mail/procmailrcs/ekoster

# Use maildir-style mailbox in user's home directory
MAILDIR_ROOT=/root/.maildir/
#MAILDIR_EKOSTER=/home/ekoster/.maildir/
#
## Begin recipes
#
:0
* ^To:.*mobile\@domain\.net
$MAILDIR_ROOT

The included file will have the same TO filter for a that user. The mail folder at moment reside in the home dir but when it works its to move to /storage/mail/boxes/$USER.

Now when mail is filtered I can't open it as a user. The permissions aren't right. I discovered that the chmod makes them readable. It's dirty, but I don't know how to solve it. I know it should be possible. I could go back using different pop accounts and fetchmails but I want the catch-all for type errors and then I can make the aliasses internal instead of going to the ISP every time. And there are to be two domains.

Adding UMASK=777 to the to of my procmailrc under SHELL didn't do the trick, oeps, thats the wrong permissions. I figured out. It will work with 000. So my workaround works.
Back to top
View user's profile Send private message
grimm26
Guru
Guru


Joined: 23 May 2004
Posts: 313
Location: Chicagoland, IL

PostPosted: Sat Mar 03, 2007 3:46 pm    Post subject: Reply with quote

UMASK of 777 would block all permissions (equivalent to chmod 000 file). UMASK of 000 will open all permissions (equivalent of chmod 777 file). I must restate that it is a very bad idea to chmod files to 777.

Also, you don't need to modify the init script for fetchmail to specify procmail as your MDA. You can specify that in the /etc/fetchmailrcor ~/.fetchmailrc.

Also, how is any mail getting to /storage/mail/boxes/$USER if you have MAILDIR_ROOT=/root/.maildir/ set? I think you are making this much more complicated than it needs to be.
_________________
"Blessed is he who finds happiness in his own foolishness, for he will always be happy".
Back to top
View user's profile Send private message
Gentoo-Ed
Guru
Guru


Joined: 21 Apr 2005
Posts: 442
Location: the Netherlands

PostPosted: Sat Mar 03, 2007 4:04 pm    Post subject: Reply with quote

Thats the location where I would like the boxes. But I can't get that working. I first going to get the other things working. Like the permissions without a workaround. I don't want 777 but until I find the right way this will work.
Back to top
View user's profile Send private message
grimm26
Guru
Guru


Joined: 23 May 2004
Posts: 313
Location: Chicagoland, IL

PostPosted: Sat Mar 03, 2007 10:26 pm    Post subject: Reply with quote

Just change the UMASK. If you want perms of 750, UMASK=027. If you want perms of 660, UMASK=117, etc. You don't need 777.
_________________
"Blessed is he who finds happiness in his own foolishness, for he will always be happy".
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum