Kar*_*pka 67 security windows-7 filesystems symbolic-link permissions
如何授予特定用户在 Windows 7 中创建符号链接的权限?
我已经搜索过“组策略”和谷歌,但没有找到任何东西。
附带说明一下,有没有办法在组策略编辑器中搜索所有内容?过滤器似乎只适用于特定的子树。我实际上从未使用过滤器找到任何东西。
Dan*_*anO 77
打开本地组策略编辑器:Run> gpedit.msc。如果这不起作用,secpol.msc请尝试(注意,Windows Home用户可能需要先启用 group-policy-editor)。
转到(Windows Pro 用户可能看不到前两项):
Computer configuration ? Windows Settings? Security Settings ? Local Policies ? User Rights Assignment并编辑Create symbolic links.

添加要允许创建符号链接的用户或组。
如果您添加了自己的用户帐户,则需要注销并重新登录以使更改生效。
注意:此设置对属于管理员组的用户帐户没有影响。由于 UAC 在创建非提升访问令牌时删除特权的方式,这些用户将始终必须mklink在提升的环境中运行(以管理员身份)。有一个方便的 Excel 参考表用于查找组策略设置:Windows 和 Windows Server 的组策略设置参考
某些 Windows 配置会丢失gpedit.msc。在这种情况下,您可以尝试以下替代方案:
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)
然后立即运行gpupdate /force以应用更改
| 归档时间: |
|
| 查看次数: |
48209 次 |
| 最近记录: |