SFTP Further Auth required

Advertisement

rwest11
Joined:
Posts:
1
Location:
England

SFTP Further Auth required

Hi Guys,

I'm trying to connect to a remote server via SFTP
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
 
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = "sftp"
    SshHostKeyFingerprint = "ssh-rsa 2048 ######c1mPs7MODjkyCxawY+wIAn1m7UmV4NdPE="
    HostName = "ftp.site.co.uk"
    UserName = "username"
    Password = "pass"   
}
$session = New-Object WinSCP.Session
 
# Connect
$session.Open($sessionOptions)
The credentials work in a GUI session but I get the below error in my script.
Exception calling "Open" with "1" argument(s): "Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log (see session log for details):
Using username "excanf".
Further authentication required
Authentication failed."
At C:\secure-file-transfer-project\Powershell-Scripts\CR_Stockfile_Import.ps1:22 char:9
+         $session.Open($sessionOptions)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SessionRemoteException
Any assistance would be appreciated

Ryan

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Did you resolve this

@george338: And I have the same answer for you: Please post session log files both from the code and GUI. Did you use GUI to generate your code template?

Reply with quote

Advertisement

You can post new topics in this forum