Solved

Changing permissions on delivered mails

Posted on 2009-05-03
16
399 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 3
16 Comments
 
LVL 78

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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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 78

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
 
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 78

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

687 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