Profiles can be very useful, but sometimes they get messed up, and you get
messages like that shown below:
One of the reasons that this can occur is that the SID of your Samba server has changed (perhaps because you changed its name). While this can be fixed, thanks to other information on this site, it would be neat to be able to go through NTUSER.DAT and change the SIDs and/or permissions associated with them.
Recently I figured out enough of the format of NTUSER.DAT that anyone could print out the SIDs and modify them. The format seems to be:
<A 'regf' block>
<A 'hbin' block>
<A 'sk' block, containing, eventually,
A SECDESC consisting of {
USHORT version
USHORT Flags
ULONG Offset to Owner SID
ULONG Offset to Group SID
ULONG Offset to SACL
ULONG Offset to DACL
Then the DACL, usually no SACL, then Owner and Group SIDs
}
>
<The rest of the registry>
Actually, it is more complex that what I have indicated above. There
are multiple SK records, one for each SEC DESC that the NTUSER.DAT file
contains. You can find more information about this at:
WinReg.txt
I have found plenty of code that understands the format, so we can
possibly
fix the SIDs in the case that you have copied profiles from an NT server
and did not set your Server's SID correctly.
I have now implemented a program called profiles that can, at a minimum,
list all the SEC DESCs, including ACLs, in NTUSER.DAT. This program is
part of Sambahead, and can be built using:
make bin/profiles
You might be able to do the following to fix the SIDs:
profiles c S1521xyzoldrid n S1521abcnewrid /path/to/profile
You will have to do that twice, once for the owner SID and once for the
group SID.
You can use net getlocalsid to find the SID of your server. Don't
forget to add the RID of the user on the end. Actually, you might be
better off to use rpcclient to find the user's SID. For example:
rpcclient Uroot%pass c 'lookupnames '
Here is an example of using:
Registry file size: 524288
First Key Off: 32, Data Block Size: 266240
Next Off: 0, Prev Off: 4096
Type: 2c
SK Off : 10204
Off: 00000080, Refs: 312, Size: 256
Owner SID: S1532544
Group SID: S1518
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S1518
Perms: 10000000, SID: S1532544
Perms: 80000000, SID: S1512
Off: 00006E28, Refs: 245, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00008750, Refs: 3, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00006968, Refs: 2, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00005E08, Refs: 5, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00002DF8, Refs: 5, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00002188, Refs: 9, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00001838, Refs: 5, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00000C28, Refs: 6, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00000980, Refs: 5, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00000608, Refs: 6, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 000002D8, Refs: 9, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00000020, Refs: 4, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 0000D958, Refs: 22, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 0000D768, Refs: 39, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 0000D108, Refs: 3, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 0000C980, Refs: 20, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 0000C408, Refs: 2, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 0000C2F0, Refs: 7, Size: 256
Owner SID: S1532544
Group SID: S1518
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 00000DC0, Refs: 9, Size: 76
Owner SID: S1532544
Group SID: S1518
SACL: NONE
DACL: ACEs: 1
Perms: 000F003F, SID: S1518
Off: 0000C1D8, Refs: 1, Size: 256
Owner SID: S1532544
Group SID: S1518
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 0000C0A0, Refs: 8, Size: 284
Owner SID: S152112973567843039534010806271172002
Group SID: S152112973567843039534010806271172003
SACL: NONE
DACL: ACEs: 8
Perms: 000F003F, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S1512
Off: 0000BCF8, Refs: 1, Size: 216
Owner SID: S1532544
Group SID: S1518
SACL: NONE
DACL: ACEs: 6
Perms: 00020019, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 80000000, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S1518
Perms: 10000000, SID: S1532544
Off: 0000BE10, Refs: 1, Size: 216
Owner SID: S1532544
Group SID: S1518
SACL: NONE
DACL: ACEs: 6
Perms: 00020019, SID: S152112973567843039534010806271172002
Perms: 80000000, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 10000000, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 10000000, SID: S1532544
Off: 0000B6B8, Refs: 11, Size: 256
Owner SID: S1532544
Group SID: S1518
SACL: NONE
DACL: ACEs: 8
Perms: 00020019, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S1518
Perms: 10000000, SID: S1532544
Perms: 80000000, SID: S1512
Off: 00000218, Refs: 2, Size: 256
Owner SID: S1532544
Group SID: S1518
SACL: NONE
DACL: ACEs: 8
Perms: 00020019, SID: S152112973567843039534010806271172002
Perms: 000F003F, SID: S1518
Perms: 000F003F, SID: S1532544
Perms: 00020019, SID: S1512
Perms: 80000000, SID: S152112973567843039534010806271172002
Perms: 10000000, SID: S1518
Perms: 10000000, SID: S1532544
Perms: 80000000, SID: S1512
Off: 00005020, Refs: 1, Size: 96
Owner SID: S1532544
Group SID: S1518
SACL: NONE
DACL: ACEs: 2
Perms: 000F003F, SID: S1518
Perms: 00020019, SID: S110
