Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows

วิธีหา Security Identifier (SID) ของบัญชีผู้ใช้ใน Windows

SID คืออะไร?

Security Identifier (SID) เป็นสตริงค่าที่ยาวๆ เช่น "S-1-5-21-3011698416-3634052959-2884390752-500" ที่ Windows ออกให้แต่ละ Security Principal (ผู้ใช้, กลุ่ม) เป็นตัวระบุตัวตนที่ไม่ซ้ำกัน สร้างอัตโนมัติเมื่อสร้างบัญชี/กลุ่ม เก็บในฐานข้อมูลความปลอดภัย ใช้เมื่อต้องการ

SID รวมกับสิทธิ์ผู้ใช้ จะสร้าง Access Token ทุกครั้งที่ล็อกอิน ให้บริบทความปลอดภัยและสิทธิ์ที่เหมาะสม SID จึงเป็นส่วนสำคัญของ Windows Security Model

Windows มี Well-known SIDs คงที่ เช่น Everyone, Local Authority, World, NT Authority, All Services

หา SID ของผู้ใช้ปัจจุบัน (Current User)

เปิด Command Prompt ใช้คำสั่งใดคำสั่งหนึ่ง:

whoami /user

หรือใช้ WMIC:

wmic useraccount where name='%username%' get name,sid

วิธีหา Security Identifier (SID) ของบัญชีผู้ใช้ใน Windows วิธีหา Security Identifier (SID) ของบัญชีผู้ใช้ใน Windows

หา SID ของผู้ใช้เฉพาะ (Specific User)

ใช้คำสั่ง WMIC เดียวกัน แต่เปลี่ยน %username% เป็นชื่อจริง:

wmic useraccount where name='krishna' get name,sid

วิธีหา Security Identifier (SID) ของบัญชีผู้ใช้ใน Windows

หา SID ของผู้ใช้ทั้งหมด (All Users)

รวมบัญชีเริ่มต้นของ Windows (Guest, Administrator, WDAGUtilityAccount ฯลฯ):

wmic useraccount get name,sid

วิธีหา Security Identifier (SID) ของบัญชีผู้ใช้ใน Windows

หรือใช้ PowerShell:

Get-WmiObject win32_useraccount | Select name,sid

วิธีหา Security Identifier (SID) ของบัญชีผู้ใช้ใน Windows

หา SID ด้วย Registry Editor

ทางเลือกสำหรับคนไม่ชอบ Command Line:

  1. เปิด regedit ไปที่:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
  2. ภายใต้ ProfileList จะเห็น SID ทั้ง Well-known และบัญชีผู้ใช้ (SID ผู้ใช้จะยาวกว่า)
  3. คลิก SID ใดๆ ด้านซ้าย → ดูด้านขวา ค่า ProfileImagePath จะบอกว่าเป็นบัญชีไหน

วิธีหา Security Identifier (SID) ของบัญชีผู้ใช้ใน Windows

สรุป

มีหลายวิธีหา SID: whoami, WMIC, PowerShell, Registry Editor เลือกใช้ตามสะดวก