Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 450
  • Last Modified:

Changing permissions on delivered mails

Hi,
I am trying to change the owner and permission files of delivered mails by Postfix. Where can I change it on main.cf?
0
QLJ
Asked:
QLJ
  • 8
  • 5
  • 3
2 Solutions
 
arnoldCommented:
What do you mean?  What permissions settings.
Are you talking about umask change from 022 to 077?
/etc/postfix/postfix-script
0
 
0renCommented:
i think file are created according to the users umask settings.
you should change it in /etc/profile
0
 
QLJAuthor Commented:
hmm, my delivered mails are not stored on /home/
It is written to another folder. See snippet below... I want to change group ownership of the following files when delivered


# pwd
/sector1/mail/server.com/user1/Maildir/cur
# ls -la
total 3008
drwxrwx---   2 postfix    staff       3584 May  4 09:38 .
drwxrwx---  10 postfix    staff        512 May  4 09:39 ..
-rwxrwx---   1 postfix    postfix       1441 Apr 29 07:26 1240961183.M407275P8237.servername,W=1475:2,RS
-rwxrwx---   1 postfix    postfix      72830 Apr 29 09:47 1240969636.M657144P1127.servername,W=74619:2,RS
-rwxrwx---   1 postfix    postfix       3730 Apr 29 10:52 1240973549.M578548P1275.servername,W=3826:2,Sb
-rwxrwx---   1 postfix    postfix      18308 Apr 29 21:13 1241010791.M212252P2743.servername,W=18675:2,S
-rwxrwx---   1 postfix    postfix     775202 Apr 30 01:20 1241025649.M40343P4860.servername,W=783619:2,
-rwxrwx---   1 postfix    postfix       6086 Apr 30 02:08 1241028522.M937303P5566.servername,W=6234:2,Sa
-rwxrwx---   1 postfix    postfix       6084 Apr 30 02:08 1241028529.M271539P5567.servername,W=6232:2,Sa
-rwxrwx---   1 postfix    postfix      16364 Apr 30 02:29 1241029783.M111680P5795.servername,W=16884:2,S
-rwxrwx---   1 postfix    postfix       2746 Apr 30 13:56 1241070967.M603215P1254.servername,W=2803:2,
-rwxrwx---   1 postfix    postfix       1458 Apr 30 13:56 1241071008.M717548P1259.servername,W=1492:2,RS

Open in new window

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
QLJAuthor Commented:
oops, made a mistake.. when created, it is of permission -rw-------
I want to give it -rwxrwx--- and change group ownership
0
 
0renCommented:
you can set gid on the directory so every file which is created under it
will be created with the directory group ownership.
if you want files to be created with the 770 perms change the umask to 002 ( /etc/profile )
instead of 022
0
 
QLJAuthor Commented:
how do you set gid on the directory? chown -R?

For the permissions, I only want the files in that particular folder to be 770, not every file. How do I specify that in /etc/profile?

0
 
arnoldCommented:
chgrp group folder, but not sure what the correct.

Are you using some system wide filtering?  You may have to drop privileges prior to delivery.  This way the files will be owned by the user rather than the postfix user.
0
 
0renCommented:
chmod 4755 directory

4 - gid
2 - uid
1 - sticky bit
0
 
QLJAuthor Commented:
chmod 4755 directory doesnt help

when the file enters the folder it is still -rw-------
0
 
0renCommented:
the file creation has nothing to do with the chmod command. only the ownership of the newly created files.
you should change your umask to 002 for the user creating the files under that directory.
the default is set in /etc/profile
0
 
QLJAuthor Commented:
how to set umask for a particular directory in /etc/profile?
0
 
QLJAuthor Commented:
and may i add, for files created by a given user only?
0
 
0renCommented:
umask is per user and not directory.
if you open /etc/profile
you will see a line like this one :
umask 022

which means all file will be created with 644 permissions and all directories with 755 permissions

umask 000 will create files with 666 and directories with 777
umask 222 will create files with 444 and directories with 555

and so on
0
 
QLJAuthor Commented:
hmm, so it seems that changing the umask will not solve the issue of changing owner and groupid of the delivered mails in the specific folder
0
 
arnoldCommented:
The user:group with which the files are stored is based on the user:group with which the process is running at the time.  Your delivery directive might be before the delivery process downshifts to run as the end user for the local delivery.

When you set the Group bid on the directory, you effectively setup that all created files will belong to that group.

you can use setfacl,getfacl to add additional permissions  settings, or you can resolve the issue you have which has the local delivery run as the user with whose credentials postfix runs.  Without knowing your setup it is hard to do.
0
 
QLJAuthor Commented:
gave up.. changing destination to user's home. Solved the problem
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 8
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now