在 Windows 7 中创建符号链接的权限?

Kar*_*pka 67 security windows-7 filesystems symbolic-link permissions

如何授予特定用户在 Windows 7 中创建符号链接的权限?

我已经搜索过“组策略”和谷歌,但没有找到任何东西。

附带说明一下,有没有办法在组策略编辑器中搜索所有内容?过滤器似乎只适用于特定的子树。我实际上从未使用过滤器找到任何东西。

Dan*_*anO 77

  1. 打开本地组策略编辑器Run> gpedit.msc。如果这不起作用,secpol.msc请尝试(注意,Windows Home用户可能需要先启用 group-policy-editor)。

  2. 转到(Windows Pro 用户可能看不到前两项):

    Computer configuration ? Windows Settings? Security Settings ? Local Policies ? User Rights Assignment并编辑Create symbolic links.

    在此处输入图片说明

  3. 添加要允许创建符号链接的用户或组。

  4. 如果您添加了自己的用户帐户,则需要注销并重新登录以使更改生效。

注意:此设置对属于管理员组的用户帐户没有影响。由于 UAC 在创建非提升访问令牌时删除特权的方式,这些用户将始终必须mklink在提升的环境中运行(以管理员身份)。有一个方便的 Excel 参考表用于查找组策略设置:Windows 和 Windows Server 的组策略设置参考

  • 这里看起来更像以下内容,仅供参考,如果有人感到困惑:控制面板 > 管理工具 > 本地安全策略 > 本地策略 > 用户权限分配 > 创建符号链接顺便说一下,您需要注销并再次登录进行设置申请。 (14认同)
  • 重新-“这些用户将始终必须在提升的环境中运行 mklink(以管理员身份)”...因此管理员总是必须以提升的...arg 运行。 (6认同)
  • 您可以运行 secpol.msc 跳过第一部分,然后剩下的就是:本地策略 > 用户权限分配 > 创建符号链接 (5认同)
  • 另外:从 CMD 或仅运行对话框运行“gpupdate /force”也应该应用该设置。 (5认同)
  • 有没有办法通过注册表为微软讨厌的非 Windows-8-Pro 用户做同样的事情?gpedit.msc 对他们不可用 (2认同)

Nik*_*vin 6

某些 Windows 配置会丢失gpedit.msc。在这种情况下,您可以尝试以下替代方案:

  1. 从此处运行此 PowerShell 脚本:
    function addSymLinkPermissions($accountToAdd){
        Write-Host "Checking SymLink permissions.."
        $sidstr = $null
        try {
            $ntprincipal = new-object System.Security.Principal.NTAccount "$accountToAdd"
            $sid = $ntprincipal.Translate([System.Security.Principal.SecurityIdentifier])
            $sidstr = $sid.Value.ToString()
        } catch {
            $sidstr = $null
        }
        Write-Host "Account: $($accountToAdd)" -ForegroundColor DarkCyan
        if( [string]::IsNullOrEmpty($sidstr) ) {
            Write-Host "Account not found!" -ForegroundColor Red
            exit -1
        }
        Write-Host "Account SID: $($sidstr)" -ForegroundColor DarkCyan
        $tmp = [System.IO.Path]::GetTempFileName()
        Write-Host "Export current Local Security Policy" -ForegroundColor DarkCyan
        secedit.exe /export /cfg "$($tmp)" 
        $c = Get-Content -Path $tmp 
        $currentSetting = ""
        foreach($s in $c) {
            if( $s -like "SECreateSymbolicLinkPrivilege*") {
                $x = $s.split("=",[System.StringSplitOptions]::RemoveEmptyEntries)
                $currentSetting = $x[1].Trim()
            }
        }
        if( $currentSetting -notlike "*$($sidstr)*" ) {
            Write-Host "Need to add permissions to SymLink" -ForegroundColor Yellow

            Write-Host "Modify Setting ""Create SymLink""" -ForegroundColor DarkCyan

            if( [string]::IsNullOrEmpty($currentSetting) ) {
                $currentSetting = "*$($sidstr)"
            } else {
                $currentSetting = "*$($sidstr),$($currentSetting)"
            }
            Write-Host "$currentSetting"
        $outfile = @"
    [Unicode]
    Unicode=yes
    [Version]
    signature="`$CHICAGO`$"
    Revision=1
    [Privilege Rights]
    SECreateSymbolicLinkPrivilege = $($currentSetting)
    "@
        $tmp2 = [System.IO.Path]::GetTempFileName()
            Write-Host "Import new settings to Local Security Policy" -ForegroundColor DarkCyan
            $outfile | Set-Content -Path $tmp2 -Encoding Unicode -Force
            Push-Location (Split-Path $tmp2)
            try {
                secedit.exe /configure /db "secedit.sdb" /cfg "$($tmp2)" /areas USER_RIGHTS 
            } finally { 
                Pop-Location
            }
        } else {
            Write-Host "NO ACTIONS REQUIRED! Account already in ""Create SymLink""" -ForegroundColor DarkCyan
            Write-Host "Account $accountToAdd already has permissions to SymLink" -ForegroundColor Green
            return $true;
        }
    }
Run Code Online (Sandbox Code Playgroud)
  1. 下载 polsedit,它看起来像是 gpedit.msc 的免费软件替代品

然后立即运行gpupdate /force以应用更改

  • 除了给出来源之外。请添加脚本,以防源不再存在。 (3认同)