The Samba-Bugzilla – Bug 5797
Moving readonly files fails
Last modified: 2008-10-06 05:09:04 UTC
I have the following configuration at home:
* Linux box (Debian 4.0): Samba Server
* Windows box (Windows XP SP3): Samba Client
On the linux box I have a file that is read-only:
-r--r--r-- 1 apache servergroup 37 2008-09-26 16:48 dir-props
The directory that contains this file has the following rights:
drwxr-xr-x 2 apache servergroup 4096 2008-09-26 17:09 .svn
This directory is accessable through a Samba share. The Samba configuration is:
netbios name = deepthought
server string = Samba Server
workgroup = Maya Group
security = user
encrypt passwords = yes
smb passwd file = /srv/config/samba/smbpasswd
guest ok = yes
null passwords = no
browsable = yes
browse list = yes
path = /srv
create mask = 0644
directory mask = 0755
valid users = manski
force user = apache
read only = no
store dos attributes = no
map read only = yes
The problem now is that I can't move/rename this file (dir-props) with the Windows API function "MoveFileEx()" through the Samba client as the file is read-only. I get an "ERROR_ACCESS_DENIED" (Code 5).
When I, however, try to do the same thing on a "native" share (i.e. from another Windows XP box) everything is fine (i.e. no error and the file is renamed afterwards).
So, I think you should change this behaviour to fit the one of "native" Windows shares. An example where this method is used is a Subversion client that tries to do a commit on a Samba share (which doesn't work).
To test this behaviour you may use the following C (maybe C++) code:
TCHAR* from_file = "Z:\\test.txt";
TCHAR* to_file = "Z:\\test2.txt";
int _tmain(int argc, _TCHAR* argv)
if (MoveFileEx(from_file, to_file, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED))
printf("Error: %d", GetLastError());
I hope this helps.
Can you attach the binary of this program as an attachment to this bug. I don't have quick access to a Windows C compiler at the moment. Also a debug level 10 log from smbd when this program fails would help.
Created attachment 3639 [details]
Patch for 3.2.x.
Here's the patch for 3.2.x. Will be in the next release. Thanks !
Marking bug as fixed.
Please re-open if it is still an issue.
Thanks for reporting!