Move files do not change group as copying does.

Ola Lundqvist opal at
Fri Jan 31 11:56:57 GMT 2003


(I'm not subscribed to please Cc: me).

I have a problem with movement of files:

The problem this time is that we have set up a permission structure
for files in about the same way as windows do, using groups.

The problem is that in windows, the files inherit the group
membership from the directory where the files (and subdirs) reside.

This works fine now if the user copy the files from one place
to the other. The problem is that if the files (and dirs) is moved
an ordinary rename(a,b) command is used which means that the
group membership is not changed. I use sgid on directorys to
emulate windows behaviour but this do not help if moving files.

I have looked at the code and see that there is a
rename(a,b) emulation function, but that tries to emulate
it truely so it gives the same problem.

My suggestion is that a recursive chgrp is performed
to the destination for all dirs and files that has the same
group id as the source file or dir.

What do you think about this?

The inherit acls = yes option do not seem to help here because,
first you need acl kernel support and second the same code for moving
files is used (but I can be mistaken).

I need to get some feedback where to patch the code and
if you are interested in it.

You can also see the debian bug:

>From IRC (if that can be interesting):

<debian-opal> Is there anyone in here who can explain how the vfs_rename function is supposed to work? Exactly what arguments can you expect that it gets?
<debian-opal> I'm trying to create a emulation of windows group membership inheritance.
<debian-opal> It works ok if copying files but not if moving.
<abartlet> debian-opal: I would be worried about the races with that proposal
<debian-opal> abartlet: Yes that can be a problem. The problem is that our customer needs to emulate that...
<idra> debian-opal: emulate what exactly?
<abartlet> you want to emulate racy windows code?
<abartlet> (I understand much of the ACL stuff races on WinNT too...)
<debian-opal> The problem is that we have set up a permission structure on a customer server. The permissions are based on the directory where things are located.
<idra> inheritance is just yet another demonstration of how good basis are converted in braindamaged implementations at MS ... :-(
<debian-opal> If you copy files the group get inherited because the sgid bit is set on the dir. The problem is with moving files.
<idra> debian-opal: so if you move files they retain the ownership ...
<idra> instead of inheriting the one set in the directory, right?
<debian-opal> Yes.
<idra> uhmmm
<idra> I think this is a bug for jeremy
<idra> have you written on samba-technical at ?
<debian-opal> Nope. I wanted to ask here if someone knew, so I could patch it nice and quickly.
<idra> then write asap on the list, maube cc to jeremy directly
<idra> debian-opal: you are using the proper smb.conf options for inheritance on that share?
<debian-opal> I think so. Are there any options that cause the rename thing not to be used?
<debian-opal> Do the dos inherit = yes really fix this?
<debian-opal> Sorry. inherit acls = yes. Don't I need acl support in the kernel?
<idra> yes you need ACL
<idra> but any kind of proper inheritance need ACLs
<idra> (Imho)
<debian-opal> Ok. The manual page is talking about creating a file/dir... not about moving.


// Ola

 --------------------- Ola Lundqvist ---------------------------
/  opal at                     Annebergsslingan 37      \
|  opal at                 654 65 KARLSTAD          |
|  +46 (0)54-10 14 30                  +46 (0)70-332 1551       |
|             UIN/icq: 4912500         |
\  gpg/f.p.: 7090 A92B 18FE 7994 0C36  4FE4 18A1 B1CF 0FE5 3DD9 /

More information about the samba-technical mailing list