【问题标题】:Tamir's SharpSSH without Password: Auth FailedTamir 的 SharpSSH 没有密码:身份验证失败
【发布时间】:2013-11-27 03:43:21
【问题描述】:
Sftp sftp = new Sftp(host, user);

// 1.   Generate an SSH-2-RSA public key by PuttyGen 
// 2.   Register the public key on the SFTP server 
// 3.   Save the private key in putty Format 
// 4.   Use WinSCP to connect to the sftp server using the private key generated in the step 3 
// 5.   If the connection works, You will have to load the private key generated in the step 3 and  convert it to OpenSSh format. 
// 6.   Use the private key generated in step 5, make sure that the authentication parameters are right, then test the tamirSftp connection. 
// 7.   Make sure that you have a reference to the three DLL (DiffieHelman, OrgMantalis and TamirSharpSSH ) 

sftp.AddIdentityFile(keyFileName);
sftp.Connect(22);

它抛出以下错误:

at Tamir.SharpSsh.jsch.Session.connect(Int32 port) 

连接 SFTP 机器是否需要密码?

【问题讨论】:

  • 你解决过这个问题吗?
  • 是的,它得到了解决:)
  • @LokiDil 虽然很久以前,但是你是怎么解决的呢?

标签: c# ssh sftp file-transfer


【解决方案1】:

我通过向AddIdentityFile() 命令添加密码参数解决了这个问题。 您可能在生成私钥时添加了密码,将其包含在您的调用中。

Sftp sftp = new Sftp(host, user);

//Include it here
sftp.AddIdentityFile(keyFileName, "yourpassphrase");
sftp.Connect(22);

【讨论】:

    【解决方案2】:

    我不太确定 WinSCP,但是对于反射 SFTP,您需要提供密码才能连接到服务器并注册公钥。 API 文档是否提供这方面的任何数据?

    【讨论】:

    • 谢谢 Shree,我找到了这里的 ssh_config 是详细信息
    • # RhostsRSAAuthentication no # RSAAuthentication yes # PasswordAuthentication yes # HostbasedAuthentication no 我是否需要将 PasswordAuthentication 更改为
    • 我已经向 SFTP 服务器注册了公钥,并尝试使用 Open SSH 格式通过 Tamir SSH 库进行连接。还是失败了
    • 在异常中我得到“身份验证失败”
    猜你喜欢
    • 2020-09-04
    • 1970-01-01
    • 2020-12-09
    • 1970-01-01
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    • 2011-09-27
    • 2020-08-22
    相关资源
    最近更新 更多