Solved

Changing permissions on delivered mails

Posted on 2009-05-03
16
360 Views
Last Modified: 2013-11-10
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
Comment
Question by:QLJ
  • 8
  • 5
  • 3
16 Comments
 
LVL 76

Expert Comment

by:arnold
ID: 24290112
What do you mean?  What permissions settings.
Are you talking about umask change from 022 to 077?
/etc/postfix/postfix-script
0
 
LVL 5

Expert Comment

by:0ren
ID: 24290482
i think file are created according to the users umask settings.
you should change it in /etc/profile
0
 
LVL 1

Author Comment

by:QLJ
ID: 24292285
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
 
LVL 1

Author Comment

by:QLJ
ID: 24292320
oops, made a mistake.. when created, it is of permission -rw-------
I want to give it -rwxrwx--- and change group ownership
0
 
LVL 5

Expert Comment

by:0ren
ID: 24292464
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
 
LVL 1

Author Comment

by:QLJ
ID: 24295987
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
 
LVL 76

Expert Comment

by:arnold
ID: 24296104
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
 
LVL 5

Expert Comment

by:0ren
ID: 24296513
chmod 4755 directory

4 - gid
2 - uid
1 - sticky bit
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 1

Author Comment

by:QLJ
ID: 24300997
chmod 4755 directory doesnt help

when the file enters the folder it is still -rw-------
0
 
LVL 5

Expert Comment

by:0ren
ID: 24301619
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
 
LVL 1

Author Comment

by:QLJ
ID: 24302884
how to set umask for a particular directory in /etc/profile?
0
 
LVL 1

Author Comment

by:QLJ
ID: 24302922
and may i add, for files created by a given user only?
0
 
LVL 5

Accepted Solution

by:
0ren earned 30 total points
ID: 24302966
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
 
LVL 1

Author Comment

by:QLJ
ID: 24304358
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
 
LVL 76

Assisted Solution

by:arnold
arnold earned 20 total points
ID: 24305074
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
 
LVL 1

Author Comment

by:QLJ
ID: 24409751
gave up.. changing destination to user's home. Solved the problem
0

Featured Post

Integrate social media with email signatures

Is your company active on social media? Do you also use email signatures? Including social media icons in your email signature is a great way to get fans for free. Let all your email users know you’re on social media quickly and easily, in a single click.

Join & Write a Comment

Suggested Solutions

MS outlook is a premier email client that enable you to send and receive the e-mails with various file formats of attachments such as document files, media file, and many others formats. There is some scenario occurs when a receiver of an e-mail mes…
Easy CSR creation in Exchange 2007,2010 and 2013
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now