AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 405940
Accepted
detly
detly
Asked: 2012-07-09 21:31:41 +0800 CST2012-07-09 21:31:41 +0800 CST 2012-07-09 21:31:41 +0800 CST

如何获取 Active Directory 用户 ID?

  • 772

首先,我什至不知道“用户 ID”在这里是否是正确的术语。

上下文是我使用 VisualSVN Server 通过 Windows 身份验证管理/管理我的 SVN 存储库的访问权限,authz-windows它创建的文件包含 45 个字符长的字符串而不是“人类可读”的用户或组名。

我需要手动编辑这个文件,那么我如何找出与特定用户或组相关联的魔法字符串呢?

active-directory visualsvn-server version-control sid
  • 2 2 个回答
  • 35986 Views

2 个回答

  • Voted
  1. Best Answer
    Max Kochubey
    2012-07-10T21:21:56+08:002012-07-10T21:21:56+08:00

    该authz-windows文件映射 Active Directory 用户和组 SID(objectSidLDAP 字段)。

    但请注意,此字段的值在 AD 中存储为十六进制,因此您可以使用以前的一些答案来确定关联的用户 ID。

    ( StackOverflow 上的PowerShell 示例。)

    • 4
  2. bahrep
    2012-07-13T06:46:53+08:002012-07-13T06:46:53+08:00

    2016 年更新:

    升级到最新的 VisualSVN 服务器版本。从 VisualSVN Server 3.4 开始,服务器附带了许多 PowerShell cmdlet。其中一些Get-SvnAccessRule可以输出为 Active Directory / Windows 用户和组帐户分配的访问规则列表。

    以下是在 CSV 文件 AccessReport.csv 中生成访问规则报告的示例:

    Get-SvnAccessRule | Select Repository, Path, AccountName, Access | Export-Csv -NoTypeInformation AccessReport.csv

    有关 VisualSVN Server PowerShell cmdlet 的完整信息,请阅读文章KB88:VisualSVN Server PowerShell Cmdlet 参考。


    过时的答案:

    我同意hangover的回答,希望您会发现以下 VBScript 对您有所帮助。它创建已定义权限的列表,并将SID正确转换为有意义且可读的DOMAIN\Username。

    '
    ' Print permissions in the form: user_name,path,level
    '
    strComputer = "."
    Set wmi = GetObject("winmgmts:" _
      & "{impersonationLevel=impersonate}!\\" _
      & strComputer & "\root\VisualSVN")
    
    Set win = GetObject("winmgmts:" _
      & "{impersonationLevel=impersonate}!\\" _
      & strComputer & "\root\cimv2")
    
    ' Return text representation for the Access Level
    Function AccessLevelToText(level)
      If level = 0 Then
        AccessLevelToText = "No Access"
      ElseIf level = 1 Then
        AccessLevelToText = "Read Only"
      ElseIf level = 2 Then
        AccessLevelToText = "Read/Write"
      Else 
        AccessLevelToText = "Unknown"
      End If
    End Function
    
    ' Return repository path for the object
    Function GetPath(obj)
      cname = assoc.Path_.Class
      If cname = "VisualSVN_Service" Then
        GetPath = "Repositories Root"
      ElseIf cname = "VisualSVN_Repository" Then
        GetPath = assoc.Name
      ElseIf cname = "VisualSVN_RepositoryEntry" Then
        GetPath = assoc.RepositoryName & ": " & assoc.Path
      Else
        GetPath = "Unknown"
      End If
    End Function
    
    ' Convert SID to user name
    Function SidToUserName(sid)
      Set account = win.Get("Win32_SID.SID='" & sid & "'")
      user = account.AccountName
      domain = account.ReferencedDomainName
      SidToUserName = domain & "\" & user
    End Function
    
    ' Return user name associated with account
    Function GetAccountName(account)
      If account.Path_.Class = "VisualSVN_WindowsAccount" Then
        GetAccountName = SidToUserName(account.SID)
      Else
        GetAccountName = account.Name
      End If
    End Function
    
    ' Iterate over all security descriptions
    Set objs = wmi.ExecQuery("SELECT * FROM VisualSVN_SecurityDescriptor")
    For Each obj In objs
      Set assoc = wmi.Get(obj.AssociatedObject)
    
      For Each perm in obj.Permissions
        name = GetAccountName(perm.Account)
        level = AccessLevelToText(perm.AccessLevel)
    
        Wscript.Echo name & "," & GetPath(assoc) & "," & level
      Next
    Next
    
    • 3

相关问题

  • 如果以域用户身份远程登录,PC 速度极慢

  • 如何在 Windows 2003 的 ou 级别应用策略

  • 允许用户更改其 Active Directory 密码的 Web 界面

  • MOSS 2007 无法使用 ActiveDirectoryMembershipProvider 配置表单身份验证

  • 通过 VPN 更改 Active Directory 密码

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve