[ale] Specify permissions, owner, and group of newly created files

Mike Murphy mike at tyderia.net
Wed Sep 1 15:20:49 EDT 2004


you can use set uid and set gid bits on directories to force files 
created in them to be owned by a certain user and/or group. For 
instance, in places where I have lots of users, and lots of files, but I 
want to make sure that said files stay writable by a certain group, I:

mkdir directory
chgrp mygrp directory
chmod g+ws directory (the w makes it writable by group, the s set's the 
gid bit)

that still doesn't ensure that the files in there get created group 
writable, it just ensures that they get the group set to "mygrp". To 
make them group writable, the umask of the creating process (be it an 
ftp server, or a shell, or whatever) would have to change. Something 
like "umask 002" would do it. That would make a new file created by that 
user get mode 664, and a new directory get 775.

You can do similar tricks with the user by setting a directory to be 
owned by some user, and then doing a 'chmod u+ws'. If its not group 
writable though, the created files wouldn't ever be updatable by anyone 
but that user, so some combination of user and group permissions are 
probably in order.

You can usually set default permissions and user and group ownership on 
a server you might be using, be it most ftp servers, or samba, which 
also might solve your problem.

Mike


Rick Huebner wrote:
> I've always wondered how to make new files created in a directory be created
> with a specific permission, owner, and group.  Right now, I have a series of
> cron jobs that run to change the permissions in several directories each
> hour.  Is there any way on a per directory basis to do this?
>  
> Rick
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale


-- 

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mike Murphy
781 Inman Mews Drive Atlanta GA 30307
Landline: 404-653-1070
Mobile: 404-545-6234
Email: mike at tyderia.net
AIM: mmichael453
JDAM: 33:45:14.0584N  84:21:43.038W
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+



More information about the Ale mailing list