[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: file creation permissions



On Tue, Nov 11, 2003 at 08:38:38PM -0800, Mike Egglestone wrote:
> Quoting Michael Kahle <michael.kahle@scc-wi.com>:
> 
> > Hello,
> > 
> > How would I force a newly created file by userA to have the permissions set
> > automatically to userB, groupB 775?
> > 
> > What I am trying to do is when a user uploads a file to our ftp server
> > (proftpd) it does not create the file using their username as the group and
> > owner of the newly created file.  I would like instead if they uploaded to
> > dirA it to have a predefined owner and group for the file created.  If they
> > upload to dirB a different owner and group etc.  Any thoughts?  Please
> > point
> > me to documentation, examples, etc.  I do not know where to start with
> > this.

I do something like this to move files to an nfs mount as a user known to 
the remote system.  Run a script as the target user to copy the file from 
a temporary spool.  You could do this using shell scripting, perl, etc.
Set the umask appropriately for the desired permissions (I find umask 
confusing, as its value is sort of the opposite of what you want to end up
with).

Ken

> 
> I don't know if its possible to modify the ownership of a newly created file.
> He who creates, becomes owner. You can use the sgid bit to modify the group 
> permission to follow that of the parent directory.
> You may want to re-think your upload plan. Perhaps there is a way to accomplish 
> what you want with the existing rules of linux permissions.
> Why do you want to change ownerships?
> 
> Mike

-- 
Ken Irving, Research Analyst, fnkci@uaf.edu, 907-474-6152
Water and Environmental Research Center
Institute of Northern Engineering
University of Alaska, Fairbanks



Reply to: