Sftp Connection

Apr 19, 2012 at 1:39 PM
Edited Apr 19, 2012 at 1:42 PM

Hello!

I am trying to connect to a Remote Server using

$PasswordConnectionInfo = New-Object Renci.SshNet.PasswordConnectionInfo($Server, $Port, $Pass, $FTPUser, $ProxyType, $ProxyHost, $ProxyPort);
$Client = New-Object Renci.SshNet.SftpClient($PasswordConnectionInfo);
$Client.Connect();


but i get this Error: "Connect" with 0 Argument(s): "User cannot be authenticated."

When i use for example WinSCP to make the connection, it works fine. Have someone an idea what the Problem is?
Thank You!

Sam

Apr 19, 2012 at 1:56 PM

try this:

SftpClient sftp = new SftpClient(_Hostname, _Username, _Password)

 

sftp.Connect();

Apr 19, 2012 at 2:40 PM
Ruhrpottpatriot wrote:

try this:

SftpClient sftp = new SftpClient(_Hostname, _Username, _Password)

 

sftp.Connect();


This did not work  too. I must use a Proxy. I am also using Powershell. It also works when i use Private Key. Ich habe that Problem only by using a Password.

Thanks!

Apr 24, 2012 at 12:39 PM

Think there must be a problem with the proxy part of what you are doing, the following works fine for me using PowerShell...

$ConnInfo = New-Object Renci.SshNet.PasswordConnectionInfo("ssh-server", 22, "user", "pass")            
$Client = New-Object Renci.SshNet.SftpClient($ConnInfo)            
$Client.Connect()            
$Client.Get("/opt/some/file")
Apr 27, 2012 at 2:48 PM
ngosi wrote:

Hello!

I am trying to connect to a Remote Server using

$PasswordConnectionInfo = New-Object Renci.SshNet.PasswordConnectionInfo($Server, $Port, $Pass, $FTPUser, $ProxyType, $ProxyHost, $ProxyPort);
$Client = New-Object Renci.SshNet.SftpClient($PasswordConnectionInfo);
$Client.Connect();


but i get this Error: "Connect" with 0 Argument(s): "User cannot be authenticated."

When i use for example WinSCP to make the connection, it works fine. Have someone an idea what the Problem is?
Thank You!

Sam

Can you give some details as to what type/name of the proxy server it is, and how it's configured?

Jun 4, 2012 at 8:18 PM

Hello

You can use Renci.Ssh (last version) for SFTP using HTTP proxy :

ConnectionInfo infoConnection = new ConnectionInfo(host, port, username, ProxyTypes.Http, "10.137.57.1", 8080, "anonymous", password,new PasswordAuthenticationMethod(username,password));

SftpClient client = new SftpClient(infoConnection); 

In my case the ProxyUser/Pass was not needed. After the creation of the SftpClient you can list files, check if file exists or download. I didn't try upload. Also i try only with HTTP proxy

 

Regards

Luis