[Pkg-samba-maint] Bug#501678: Files copied/moved to cifs filesystems get attributes changed

Steve Langasek vorlon at debian.org
Fri Oct 10 20:01:50 UTC 2008


tags 501678 confirmed upstream
thanks

On Thu, Oct 09, 2008 at 02:45:27PM +0100, Chris Carr wrote:
> Package: smbfs
> Version: 2:3.2.3-1

> I'm no expert on samba/cifs but something has changed recently. I've used
> smbfs for mounting filesystems of other machines on my LAN for years, with
> no problems once permissions are all sorted out. 

> In the past year or so I've noticed dozens of files appearing on my console
> in green (executable) - things like .txt files, which should never get +x. 

> I've traced this to samba. Now, whenever I copy/move a file onto a mounted
> smbfs filesystem, or create a new file on such a filesystem, the file
> automatically gets permissions 755. 

> Presumably the permissions of new files are controlled by a umask setting
> somewhere - I can't see one on the manual page of mount.cifs, so maybe it's
> done in the samba server config. But why would existing files have their
> attributes changed when they're copied or moved onto a smbfs filesystem?
> This seems to be a bug - surely samba should not mess with file attributes
> unless the user explicitly tells it to do so. 

Are you sure this is happening when you move files?  I see it when I copy
files, but not when I move them.

The reason for this is that 'mv' or 'cp -p' will explicitly set the file
mode with fchmod(); if you run 'cp' without the '-p' option, then the mode
on the new file is not copied separately, it's expected to be set by the
option passed to open() which comes from the user's umask.

It looks like this is somehow related to the handling of 'map archive'
between client and server.  If you set 'map archive = no', then the
executable bit is not set.

This is only a workaround, though - it's still a bug if our POSIX client is
getting the execute bit set when the user isn't asking for it.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org





More information about the Pkg-samba-maint mailing list