Unix UID 与 Windows SID - 为什么?
据我所知,Unix 中的 UID 是由管理员分配的,而 Windows 中的 SID 是随机的。这背后是否有安全原因,或者只是解决 ID 的不同方法?
谢谢
From what I've read UIDs in Unix are assigned by the administrator while the SIDs are random in Windows. Is there a security reason behind this, or is it just different ways to solve IDs?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
虽然您可以在 Unix 机器上手动编辑 /etc/passwd (和 /etc/shadow),但添加用户的标准方法是通过 useradd 实用程序(或类似的),它应该自动分配下一个用户可用的 UID。因此它们应该自动分配,而不是由管理员分配。 SID 更复杂(即分层),因此手动分配它们会更加麻烦(而且无论如何,您都无法手动更新 SAM 数据库)。
至于随机分配它们,SID 的随机部分是机器 SID,这使 SID 具有明确的优点(与 Unix UID 相对)。例如,如果 MACHINE1 有本地用户 ALICE 和一个 NTFS 卷,其中包含一些由 MACHINE1\ALICE 拥有的文件,当您将此卷插入 MACHINE2 时,它不会错误地认为这些文件由某个本地 MACHINE2 用户拥有,而这些文件只是碰巧具有相同的 SID(无论名为 ALICE 还是其他名称)。
在 Unix 上,如果 alice 在 MACHINE1 上有 UID 501,那么您将相同的卷插入 MACHINE2,其中 UID 501 属于 bob,ls 将显示文件属于 bob(而不是 alice 甚至“未知 UID”) 。
While you may edit /etc/passwd (and /etc/shadow) by hand on a Unix machine, the standard way to add users is through a
useradd
utility (or similar) which should automatically assign the next available UID. So they should be assigned automatically rather than by the administrator. SIDs are more complicated (i.e. hierarchical) so assigning them by hand would be even more cumbersome (and besides, you cannot update the SAM database by hand anyway).As to assigning them randomly, the SID's random part is the Machine SID, which gives SID the advantage of being unambiguous (as opposed to Unix UIDs). For example, if MACHINE1 has local user ALICE and an NTFS volume with some files owned by MACHINE1\ALICE, when you plug this volume into MACHINE2, it won't make a mistake of thinking those files are owned by some local MACHINE2 user which just happens to have the same SID (whether named ALICE or otherwise).
On Unix, if alice had UID 501 on MACHINE1, then then you plug the same volume into MACHINE2 where UID 501 belongs to bob, ls will show the files as belonging to bob (rather than to alice or even to an 'unknown UID').
UUID 和 SID 本质上是同一件事。
它们是系统特定部分和时间戳的组合,根据特定算法生成(在实现之间可能有所不同,但这是无关紧要的)。
本质上它们都是半随机的。也许一些 Unix 管理员相信有一些“安全”原因不分发它们或其他什么,但这是无稽之谈。
UUIDs and SIDs are essentially the same thing.
They're a combination of a system specific part and a timestamp, generated according to a specific algorithm (which might be different between implementations, but that's irrelevant).
Essentially they're both semi-random. Maybe some Unix admins are convinced there's some "security" reason for not handing them out or whatever, but that's nonsense.
Windows SID 是全局唯一标识符,而 Unix UID 不是全局唯一的。
The windows SID is a GLOBALLY Unique Identifier vs the Unix UID which is not globally unique.