Help - Search - Members - Calendar
Full Version: Saving File Opened Via Samba Fails
OESF Forums > General Forums > General Support and Discussion > Security and Networking

I have a problem:

Most of the times I open a file (mostly Excel XLS) remotely on the desktop from the SD card in my Zaurus, which is acessed via SMB / Samba from the Windows desktop, it opens the file nicely, but when I save my changes, Windows says that it couldn't save the file because the file "is used by another user" (freely translated from german error message).
I am asked to save it temporarily under another name or discard my changes.

It does not happen with all files.
I have not found a pattern yet when it does happen and when not.

Sometimes it even says "File is read-only or encrypted" and refuses to open the file at all.

What could be the reason for this?
The file is not used by another user ot application at that time.


edited: It's of course Samba, not NFS as I wrote before!
Now I observed what's happening:

I open an excel file which has the rights -rwxrwxrwx root:root with Excel in Windows XP.
The file is stored on an ext2 FS in the Zaurus (SD card).

I modify the file and save it. no problem.
But after that, the file is -rwxr-xr-x zaurus:qpe

I open the file once more and modify it. Saving then fails with the hint that another user has locked the file.

Any way to tell Samba not to modify the owner and right settings?

well for one there is the mask option to keep the file 777 or was it the force mode option? One of them should force the mode you want. I'm not sure if there is an option that will retain the mode.

Ownership is another thing. I think there is a force user option too, but I'm unsure how to retain the original user of the file.
Ownership is a problem... ownership is coming from the samba default config (smb.conf) because Excel always works on a copy of the file, deletes the original and then writes back under the original filename - thus current user = what is configured in smb.conf for anonymous access. (look for force user)

755 right is coming from the samba create mask. (see create mode in smb.conf)

As I understand it, and experienced myself...

Samba will allow you to make the remote file appear as any arbitrary user on the local system, and thus apparently read-writable by that user.

HOWEVER, the actual ownership and protection on the file server might be quite different, so you might have read-only access in reality!
I have further results.
With the owner and access right things I am clean now I think. However, there is still the same problem when working on Word and Excel files (and others, too).

The reason seems to be:

If I create a file in /mnt/card (ext2) using Windows rightclick in Explorer "new" / "Text file", the file is created with the file name "NewFile.txt" (verified with ls on the zaurus). Explorer asks user to rename the file to the wanted file name. Works. Filename: test1. (verified with ls on the zaurus).

If I create another file the same way, it works, too. Filename: test2.
If I create another file the same way, it works, too. Filename: test3.

Deleting test2 and test3 from Explorer works, too. (verified with ls on the zaurus).

Now I want to recreate test2 the same way I created it above. FAILS!
After giving the name in explorer, I get the error message
"error renaming file or directory - NewFile.txt cannot be renamed: Access denied") (freely translated from a German Windows version).

I end up having the files test2 and "NewFile.txt" in my directory.

Deleting "NewFile.txt" from Explorer fails (NewFile.txt cannot be deleted, access denied).
Deleting NewFile.txt directly on the Zaurus works without any problem.

So it seems the Samba system blocks access to a file which has been used before, i.e. forgets to remove a lock or something like that.
Recreating the "newfile.txt" still worked, but renaming it to the name of a file which has been deleted before fails. Strange, isn't it?
Any ideas?

Help would be greatly appreciated, as I often work on Zaurus files using a Windows Computer connected via network. This is annoying!

Maybe it's possible to entirely disable access right / locking stuff with Samba? That would definitely help, as I take care noone else is getting access to the data, the file sysem does not have to do this. But OTOH I need ext2 features because I have a build system on the card and files for which I need the atime feature (Inodes accesstime), which is not available in vfat.

Thank you very much
hmmm....could this be some sort of caching problem? Do oplocks come into play here? I couldn't reproduce this on a sun machine using samba. I'll have to check it out when I get home. I've never seen this behaviour
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.