[Samba] User executional bit set when creating/modifying file on linux server from linux client

Jeff Layton jlayton at samba.org
Wed Dec 2 05:08:48 MST 2009


On Wed, 02 Dec 2009 10:19:52 +0100
Fredrik Liljegren <fredrik at liljegren.org> wrote:

> Whenever I create or modify a file on my cifs-mount, be it by `echo
> "test" >> file` or from bash, the file mode is changed with u+x.
> However, that does not happen with touch, and usign chmod u-x works as
> it should.  This is very annoying...
> 
> It is a linux samba server running samba 3.0.24.  I know it's not the
> latest, and if you know there was a bug fixed that can solve my problem,
> I can probably get the serveradmins to upgrade it... but if it's a
> config problem, that's easier...
> 
> I use linux mount.cifs version: 1.12-3.4.3
> 
> On another computer here, runnig ubuntu instead of debian, and
> mount.cifs 1.12-3.3.2, modifying files does NOT set u+x!
> 
> 
> 
> Example:
> 
> Initial directory:
> 
> fiddur at ydalar:~/mnt/liljegren/tmp$ ls -la
> totalt 0
> drwxrwxr-x  2 fiddur fiddur 0  2 dec 09.51 .
> drwxrwsr-x 15 fiddur fiddur 0  2 dec 09.51 ..
> 
> 
> Creating file with touch doesn't get any u+x:
> fiddur at ydalar:~/mnt/liljegren/tmp$ touch test1
> fiddur at ydalar:~/mnt/liljegren/tmp$ ls -la
> totalt 0
> drwxrwxr-x  2 fiddur fiddur 0  2 dec 09.52 .
> drwxrwsr-x 15 fiddur fiddur 0  2 dec 09.51 ..
> -rw-rw-r--  1 fiddur fiddur 0  2 dec 09.52 test1
> 
> 
> Creating a file by output redirection gives u+x:
> fiddur at ydalar:~/mnt/liljegren/tmp$ echo "hej" > test2
> fiddur at ydalar:~/mnt/liljegren/tmp$ ls -la
> totalt 4
> drwxrwxr-x  2 fiddur fiddur 0  2 dec 09.53 .
> drwxrwsr-x 15 fiddur fiddur 0  2 dec 09.51 ..
> -rw-rw-r--  1 fiddur fiddur 0  2 dec 09.52 test1
> -rwxrw-r--  1 fiddur fiddur 4  2 dec 09.53 test2
> 
> Removing with chmod works:
> fiddur at ydalar:~/mnt/liljegren/tmp$ chmod u-x test2
> fiddur at ydalar:~/mnt/liljegren/tmp$ ls -la
> totalt 4
> drwxrwxr-x  2 fiddur fiddur 0  2 dec 09.53 .
> drwxrwsr-x 15 fiddur fiddur 0  2 dec 09.51 ..
> -rw-rw-r--  1 fiddur fiddur 0  2 dec 09.52 test1
> -rw-rw-r--  1 fiddur fiddur 4  2 dec 09.53 test2
> 
> Modifying with appending redirection adds u+x too:
> fiddur at ydalar:~/mnt/liljegren/tmp$ echo "test" >> test1
> fiddur at ydalar:~/mnt/liljegren/tmp$ ls -la
> totalt 8
> drwxrwxr-x  2 fiddur fiddur 0  2 dec 09.53 .
> drwxrwsr-x 15 fiddur fiddur 0  2 dec 09.51 ..
> -rwxrw-r--  1 fiddur fiddur 5  2 dec 09.54 test1
> -rw-rw-r--  1 fiddur fiddur 4  2 dec 09.53 test2
> 
> 
> 
> Additional info:
> 
> fiddur at ydalar:~/mnt/liljegren/tmp$ cat /proc/fs/cifs/DebugData
> Display Internal CIFS Data Structures for Debugging
> ---------------------------------------------------
> CIFS Version 1.58
> Active VFS Requests: 0
> Servers:
> 1) Name: xxx.xxx.xxx.xxx  Domain: XXXXXXXX Uses: 1 OS: Unix
>     NOS: Samba 3.0.24    Capability: 0x80f3fd
>     SMB session status: 1    TCP status: 1
>     Local Users To Server: 1 SecMode: 0x3 Req On Wire: 0
>     Shares:
>     1) \\EFFIE\liljegren.devshop Mounts: 1 Type: NTFS DevInfo: 0x0
> Attributes: 0x2b
> PathComponentMax: 255 Status: 0x1 type: 0
> 
>     MIDs:
> 
 

That is strange, I'm not aware of anything in cifs that would change inode
permissions on a write call. Some questions:

What mount options are you using?

Does the server have any special "create mode" or "create mask" type
settings that might affect the mode assigned to the inode?

What kernel is this client running?

What kernel is the ubuntu client running?

It might be interesting to see a wire capture while recreating this.
Instructions on doing that are here:

http://wiki.samba.org/index.php/LinuxCIFS_troubleshooting

If you like, you can send the capture to me directly and I'll have a
look.

-- 
Jeff Layton <jlayton at samba.org>


More information about the samba mailing list