Bug 2646 - file open over cifs results in "access denied", but the file is truncated ?!?
Summary: file open over cifs results in "access denied", but the file is truncated ?!?
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 2.6
Hardware: All Linux
: P3 normal
Target Milestone: ---
Assignee: Steve French
QA Contact:
Depends on:
Reported: 2005-04-25 04:42 UTC by Olivier Sessink
Modified: 2009-09-25 15:28 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Sessink 2005-04-25 04:42:20 UTC
On the server 'pkedu' (Debian Woody, samba 2.2.3a-15), I have a file which I am
not the owner of, but it is group writable, and my account is in that specific

olivier@pkedu:/home/pkedu/olivier/bftest$ ls -l
-rw-rw-r--    1 tinri    pkedu           0 Apr 25 12:03 testfile.txt
olivier@pkedu:/home/pkedu/olivier/bftest$ ls -l ../
drwxrwsr-x    2 tinri    pkedu        4096 Apr 25 12:01 bftest

*note*: the directory has the "set group id on execution" bit set!

olivier@pkedu:/home/pkedu/olivier/bftest$ id
uid=1000(olivier) gid=1000(olivier) groups=1000(olivier),104(pkedu)

The samba server is configured:

   path = /home/pkedu
   public = no
   create mask = 0664
   writable = yes
   valid users = @pkedu
   force group = +pkedu
   directory mask = 0775

I mount it on my desktop machine 'olidell' with these options:

mount.cifs //pkedu/pkedu ~olivier/pkedu -o

machine 'olidell' is running plain Linux 2.6.10
on 'olidell' I get this directory listing:

olivier@olidell:~/pkedu/olivier/bftest$ ls -l
-rw-------  1 olivier olivier 6 Apr 25  2005 testfile.txt

*note*: the file is 6 bytes

now I try to overwrite the contents of the file

olivier@olidell:~/pkedu/olivier/bftest$ echo hallo > testfile.txt
bash: testfile.txt: Permission denied
olivier@olidell:~/pkedu/olivier/bftest$ ls -l
-rw-------  1 olivier olivier 0 Apr 25 13:32 testfile.txt

*note*: although I got a permission denied, the file is truncated to 0 bytes!!!!!

the BUG: 
- I think I have the required permissions to write that file, so I should not
have gotten the "permission denied" error. But much more troubling: Any user who
tries to write this file, will think the original file is still there, and not
expect that file to be truncated!!

extra info: appending to this file over samba works as expected
olivier@olidell:~/pkedu/olivier/bftest$ echo hallo >> testfile.txt

also writing on the file on the server, with the same account, works as expected:
olivier@pkedu:/home/pkedu/olivier/bftest$ echo boe > testfile.txt
Comment 1 Olivier Sessink 2005-04-26 05:46:23 UTC
Trying the same server configuration with smbfs on the client-side works as
expected. I get no permission denied, the file is written as expected.
Comment 2 shirishpargaonkar@gmail.com 2009-03-23 09:09:15 UTC
Is this still an issue that needs to be worked on?
Comment 3 shirishpargaonkar@gmail.com 2009-08-27 11:33:49 UTC
I can't recreate this bug.  There was no permission denied and file
did not get truncated to size 0.
Comment 4 Steve French 2009-09-25 15:28:26 UTC
Maybe no longer a problem due to some fixes we did to rename and delete but certainly can't recreate any more