[Samba] Problem with setting Normal attribute for a file owned by another user

Oleg Starshinov olegstarshinov at ameritech.net
Wed Nov 30 19:16:07 GMT 2005


Hi Everyone,
We have a Samba 3.0.20b server running in a multi-user environment.
There is a "serveruser" username that does batch processing on the files 
using VB.NET code.
There are many other regular users: "user1", "user2", etc...
They are all part of the "users" group
If "user1" opens up a file in Excel, it changes the ownership on the 
file and permissions to:
    User - rwe
    Group - rw-
    Other - ---

The default setting is:
    User - rwe
    Group - rwe
    Other - ---

I can live with the change of the permissions, but it also changes the 
ownership from "serveruser" to "user1".

As part of my code, the server applies a "Normal" attribute to the files 
once it is done copying them.
It works fine when the "serveruser" is the owner of the file, but when 
someone else owns the file an exception is raised.
This is the line of code: File.SetAttributes(myFile.FullName, 
FileAttributes.Normal)
I can open and save the files with any user name, but the setting of the 
attribute is only allowed if I own the file.
Is this by design or am I missing something?

As a workaround I included this line in the conf file:
force user = serveruser
I would rather have the last user that saved the file to be registered 
as the owner.

Here is the conf file relating to that share:
    writeable = yes
    path = /data
    force user = serveruser
    write list = @users
    force directory mode = 2775
    force group = users
    valid users = user1,user2,serveruser, at users
    create mode = 0771
    directory mode = 2775

Thanks,
Oleg.


More information about the samba mailing list