Page 1 of 1

Reset security attributes on move operation

Posted: 14 May 2008 21:52
by MrSpock
When copying a file or moving it to another volume, permissions are inherited from the parent folder in the new location. But when moving a file in the same volume, original permissions are preserved. This behavior makes move operations unreliable, particularly in multi-user environments. This is true for both Explorer and XYplorer, but with Explorer it's possible to reset permissions even on move operations by reseting MoveSecurityAttributes in registry.

I would appreciate a corresponding option in XYplorer. It's possible to achieve this by passing the FOF_NOCOPYSECURITYATTRIBS flag to the SHFileOperation function.

Regards,

MrSpock

Re: Reset security attributes on move operation

Posted: 14 May 2008 22:14
by admin
MrSpock wrote:When copying a file or moving it to another volume, permissions are inherited from the parent folder in the new location. But when moving a file in the same volume, original permissions are preserved. This behavior makes move operations unreliable, particularly in multi-user environments. This is true for both Explorer and XYplorer, but with Explorer it's possible to reset permissions even on move operations by reseting MoveSecurityAttributes in registry.

I would appreciate a corresponding option in XYplorer. It's possible to achieve this by passing the FOF_NOCOPYSECURITYATTRIBS flag to the SHFileOperation function.

Regards,

MrSpock
Ah, did you know how much like wishes that come packed with the solution right away? :D So, to polish your wish, how would you call the checkbox in configuration? "Move Security Attributes" ? Or should I simply read out that registry value?

Posted: 14 May 2008 22:58
by MrSpock
I guess not all customers are software developers. :)

I'll be satisfied if you read that registry value, but a checkbox is probably a better choice for most users. Suggestion: "Preserve permissions on move operation" (on by default)

Thanks! I guess I have to upgrade to v7 now... :)

Posted: 15 May 2008 11:26
by admin
MrSpock wrote:I guess not all customers are software developers. :)

I'll be satisfied if you read that registry value, but a checkbox is probably a better choice for most users. Suggestion: "Preserve permissions on move operation" (on by default)

Thanks! I guess I have to upgrade to v7 now... :)
Are you sure that only the Move operation is affected by this setting? The documentation seems to include the Copy operation as well...

Posted: 15 May 2008 12:11
by MrSpock
Well, security attributes are always reset when a file is created. If you copy a file or move it to a different volume, a new file is created. But if you move a file in the same volume, the file isn't physically moved. There is just a new link to the file. That's why permissions are preserved as default on move operations in the same volume.

This blog post explains the details:
http://blogs.msdn.com/oldnewthing/archi ... 17181.aspx

Posted: 15 May 2008 12:41
by admin
MrSpock wrote:Well, security attributes are always reset when a file is created. If you copy a file or move it to a different volume, a new file is created. But if you move a file in the same volume, the file isn't physically moved. There is just a new link to the file. That's why permissions are preserved as default on move operations in the same volume.

This blog post explains the details:
http://blogs.msdn.com/oldnewthing/archi ... 17181.aspx
Ah, okay. Then this should do:

Code: Select all

    + Configuration | Advanced: Added option "Preserve permissions on 
      move operation". When checked (which is the default and was up to 
      now the hard-coded behavior) then the security attributes of files 
      are preserved when they are moved in the same volume. Uncheck it to 
      have the moved files inherit the security attributes of their new 
      folder.
Looks good?

Posted: 15 May 2008 13:08
by MrSpock
Perfect!