I want to copy my home directory to a new install of the same version of windows. On my new install, my user name will correspond to a new UUID, so I want to edit the permissions to add the a copy of the existing permissions with the new UUID (file by file)

I want to do that with a shell script on Linux. How can I get and set those permissions with scriptable commands ?

  • Please, see my answer to similar question: unix.stackexchange.com/a/437138/273268 – Yurij Goncharuk Apr 20 '18 at 12:20
  • Thank-you for this hint. It feels that the right command in this case would be setfacl and getfacl instead on setfattr and getfattr, but I need to examine the manpages. – Camion Apr 20 '18 at 12:50
  • after examination, it seems it doesn't work, because it work with unix like permissions. I'm looking for something which would keep the ntfs security structure. – Camion Apr 20 '18 at 13:25
  • Please specify the full path of the old home directory and the target directory. – agc Apr 20 '18 at 15:51
  • @agc: I do not understand what you mean. I do not have an old and a new home directory. I have a file (or a directory), with some permissions given to some SID, and I want to read those permissions, and then add the exact same permissions on the same file, but associated with another SID. – Camion Apr 23 '18 at 16:14

You can't at all, unless you know in advance what SID your user will have on the new Windows install (which is not predictable like UID's are on UNIX systems).

Assuming you have some way of knowing what SID you will have, you can functionally replicate ownership and basic ACE's by using regular UNIX commands and the NTFS-3G username mapping functionality. See the 'User Mapping' section of the NTFS-3G manpage for info on how to set that up. Once that is set up, you can use regular UNIX commands to manipulate ownership and basic permissions of files (IIRC, POSIX read permission translates to 'Read' and 'Read & Execute' Windows permissions, and POSIX write translates to 'Modify', but I don't remember any beyond that).

As far as I know, there is no way from Linux to copy all Windows ACE's.

One slight side note, you probably want to copy NTFS Alternate Data Streams too. You can do this easily with UNIX tools that support Linux xattrs (provided you don't supply a streams-interface option to NTFS-3G, it will default to exposing them as xattrs).

  • knowing the SID is not a problem : I'm doing that AFTER I created the new install – Camion Apr 20 '18 at 20:14
  • If you're right about the fact that there is no way to edit all windows ACE on linux, this means that I will have to do it from windows which might make things uglier. – Camion Apr 26 '18 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.