preserving file permissions for samba shares when file is edited preserving file permissions for samba shares when file is edited linux linux

preserving file permissions for samba shares when file is edited


Could finally figure out why permission was changing. The confusion arose from the map archive = yes setting being the default value in Samba. After setting map archive = no, the owner execute bit started behaving like I expected it to behave.

Found the answer by reading the documentation over here: http://www.samba.org/samba/docs/using_samba/ch08.html in the File Permissions and Attributes on MS-DOS and Unix section. It clearly mentions this side effect:

Consequently, there is no use for any of the three Unix executable bits that are present on a file in a Samba disk share. DOS files, however, have their own attributes that need to be preserved when they are stored in a Unix environment: the archive, system, and hidden bits. Samba can preserve these bits by reusing the executable permission bits of the file on the Unix side--if it is instructed to do so. Mapping these bits, however, has an unfortunate side effect: if a Windows user stores a file in a Samba share, and you view it on Unix with the ls -al command, some of the executable bits won't mean what you'd expect them to.

However, it also mentions this:

We should warn you that the default value of the map archive option is yes, while the other two options have a default value of no. This is because many programs do not work properly if the archive bit is not stored correctly for DOS and Windows files. The system and hidden attributes, however, are not critical for a program's operation and are left to the discretion of the administrator.

You can also read more about the archive bit over here: http://en.wikipedia.org/wiki/Archive_bit