gpt4 book ai didi

c# - Tamir的没有密码的SharpSSH:验证失败

转载 作者:行者123 更新时间:2023-12-02 14:38:37 34 4
gpt4 key购买 nike

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机器是否必须输入密码?

最佳答案

我通过在AddIdentityFile()命令中添加密码短语参数来解决此问题。
生成私钥时,您可能添加了密码,并将其包含在 call 中。

Sftp sftp = new Sftp(host, user);

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

关于c# - Tamir的没有密码的SharpSSH:验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19972430/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com