Using umask instead of explicit mode bits to create files/directories

Robert Dahlem Robert.Dahlem at
Mon Dec 4 23:43:41 GMT 2000


On Wed, 29 Nov 2000 11:41:56 -0500, David Collier-Brown wrote:

>	[Synopsis: it's hard to get permission right if they are
>	implemented via a whole bunch of masks, and ACLs just 
>	make it worse by introducing a minimum of two more]
>	Ok, I've found the problem, but it's not entirely
>	a bug (I was hoping!)
>	The umask of 022 really does say to remove
>	group write... therefor we need to set the umask to
>	correspond to the appropriate modes and masks that
>	are set in the smb.conf file.
>	This can be dome with your suggested code:


>int dos_mkdir(char *dname,mode_t mode)

Take care! This seems to be 2.0.7 code and dos_mkdir() has changed 
(and moved :-) since 2.0.7.

>  /* We don't need this fix in solaris 2.6. Kind of strange to use
>dos_chmod when the mkdir call returns success?!

This has been on a looooong thread (compared to such a small piece of 
code) and a cure has been found (please don't hope things could have 
been becoming less complicated, it took me nearly a whole day to 
understand my own patch :-).  

Be aware of the fact that dos_chmod() fiddles around with modes when 
we are running with "inherit permissions = yes".


Robert.Dahlem at           Fax +49-69-432647

Sent using PMMail ( - fast, decent, email
software; far better than Outlook. Try it sometime.

More information about the samba-technical mailing list