OESF Portables Forum

Everything Else => General Support and Discussion => Zaurus General Forums => Archived Forums => Security and Networking => Topic started by: daniel3000 on March 06, 2006, 08:13:02 am

Title: Saving File Opened Via Samba Fails
Post by: daniel3000 on March 06, 2006, 08:13:02 am
Hello,

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.

Thanks
daniel

edited: It's of course Samba, not NFS as I wrote before!
Title: Saving File Opened Via Samba Fails
Post by: daniel3000 on March 06, 2006, 09:12:05 am
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?

thanks
daniel
Title: Saving File Opened Via Samba Fails
Post by: bluedevils on March 06, 2006, 10:26:56 am
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.
Title: Saving File Opened Via Samba Fails
Post by: iamasmith on March 06, 2006, 10:29:47 am
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)

-Andy
Title: Saving File Opened Via Samba Fails
Post by: speculatrix on March 06, 2006, 06:46:47 pm
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!
Title: Saving File Opened Via Samba Fails
Post by: daniel3000 on March 09, 2006, 08:36:44 am
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
daniel
Title: Saving File Opened Via Samba Fails
Post by: bluedevils on March 09, 2006, 09:39:09 am
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