Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

powershell - Getting access denied while running invoke command ,kerberos dula hop delegation authentication error

Hi I am getting below access denied error while accessing file remotely even though I have access to shared location .Kerberos credential delegation is enabled

PS C:Users> $uname = "abracsvc-igniopro-connect"
$password = "P@er***" | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $uname,$password
Invoke-Command -ComputerName EABP01IGCHEA01 -Credential $cred -ScriptBlock {Get-Content "\Ebrfile01csITINFRA IGNIO SOXvdi NS list 1.csv"}
Access is denied
    + CategoryInfo          : PermissionDenied: (\Ebrfile01cs...i NS list 1.csv:String) [Get-Content], UnauthorizedAccessExceptio 
   n
    + FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetContentCommand
    + PSComputerName        : EABP01IGCHEA01
 
Cannot find path '\Ebrfile01csITINFRA IGNIO SOXvdi NS list 1.csv' because it does not exist.
    + CategoryInfo          : ObjectNotFound: (\Ebrfile01cs...i NS list 1.csv:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
    + PSComputerName        : EABP01IGCHEA01

question from:https://stackoverflow.com/questions/65924166/getting-access-denied-while-running-invoke-command-kerberos-dula-hop-delegation

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have to enable CredSSP (see: Enable-WSManCredSSP) on both the client and server (necessary for this double hop authentication).

First enable on your client to server direction by running this on your machine:

Enable-WSManCredSSP -Role "Client" -DelegateComputer "EABP01IGCHEA01"

Then on your server EABP01IGCHEA01, enable the Server role so that it can act as a delegate:

Enable-WSManCredSSP -Role "Server"

Then you have to explicitly specify the authentication method as CredSSP as it won't connect with it by default:

Invoke-Command -ComputerName EABP01IGCHEA01 -Authentication Credssp -Credential $cred -ScriptBlock {Get-Content "\Ebrfile01csITINFRA IGNIO SOXvdi NS list 1.csv"}

Please note the security implications of enabling CredSSP:

Caution:

CredSSP authentication delegates the user credentials from the local computer to a remote computer. This practice increases the security risk of the remote operation. If the remote computer is compromised, when credentials are passed to it, the credentials can be used to control the network session.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...