Fredrik Liljegren
2009-Dec-02 09:19 UTC
[Samba] User executional bit set when creating/modifying file on linux server from linux client
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: Regards, Fredrik
Jeff Layton
2009-Dec-02 12:08 UTC
[Samba] User executional bit set when creating/modifying file on linux server from linux client
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>
Jeff Layton
2009-Dec-02 20:28 UTC
[Samba] User executional bit set when creating/modifying file on linux server from linux client
On Wed, 02 Dec 2009 16:53:53 +0100 Fredrik Liljegren <fredrik at liljegren.org> wrote:> Jeff Layton wrote: > > I was actually more interested in a wire capture, but this tells me > > something too... > > > > The logs here indicate that unix extensions were in effect. With that, > > the file_mode and dir_mode should really never have any effect. I have > > a feeling that these are bugs that existed prior to the big overhaul of > > inode handling that went into 2.6.31. > > > > Is there a way for you to test a more recent kernel here (something > > 2.6.31 or 2.6.32-ish)? > > > I upgraded to 2.6.31-1-amd64 (debian sid), but that didn't change > anything. Without file_mode in the mount, a simple file change still > adds u+x. > > /F > > PS: I tried without nodfs, but then I get permission denied trying to > change mode with chmod u-x... >(adding samba list back to cc list) I see where we do send the mnt_file_mode in a posix open call if we're opening an existing file. The server should ignore that however. Even if it didn't, 3.0.24 probably has broken posix open calls for existing files so I'm not sure it would use that codepath anyway. This sounds really strange. Could you get a wire capture so we can see what's happening there? It might also be best to open a bug at bugzilla.samba.org as that would give us a better forum for tracking this issue. If you do that, please add me to the cc list (or email me with the bug number and I'll add myself). Thanks, -- Jeff Layton <jlayton at samba.org>
Seemingly Similar Threads
- [Bug 1841] New: Error message if key not first in authorized_keys file
- [Bug 1765] New: Error message if key not first in authorized_keys file
- IPv6 broken under AIX?
- Setauthdb defined twice in openssh-4.0p1 on AIX 5.3
- Basic configuration problem "not a directory"