Why does `ls` in Linux and macOS show different owners (uid) for the same file?
6
votes
1
answer
2688
views
I copied some files to HFS+, using macOS, ensuring that it was copied exactly. On macOS these copied files have 501 as owner according to
ls -han
.
I then plug in the HFS+ usb stick into Ubuntu, and there the files have 1000 as owner according to ls -han
. Why?
I then tried copying one of the 501 owned files in Ubuntu (to the same HFS+ volume), ensuring that it was copied exactly using cp -a
.
Now macOS ls
sees the new file as owned by user 1000...
Really? I don't understand — what was the point of using cp
with the -a
option if it doesn't even preserve the owner's user id? What did I miss?
**Update:** To clarify, I think my confusion here stems from that — in my mind — HFS supports Unix file permissions natively and should "just work" with them.
---
I recently learned that cp
s preserve=timestamps
does not, in fact, preserve time stamps (creation dates are reset). Am I now to believe that its preserve=ownership
does not preserve ownership?
Asked by Andreas
(573 rep)
Sep 10, 2023, 09:07 PM
Last activity: Sep 18, 2023, 09:38 PM
Last activity: Sep 18, 2023, 09:38 PM