码:

var connectionInfo = new ConnectionInfo(Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_SERVER), Convert.ToInt32(Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_PORT)),
                Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_USERID),
                new PasswordAuthenticationMethod(Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_USERID)
                                               , Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_PWD)),
                new PrivateKeyAuthenticationMethod(Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_USERID),
                     new PrivateKeyFile(File.OpenRead(@"C:\Jobs\Test\id_rsa"), "testpwd"))
            );

它在privateKeyfile处失败,有人可以帮助我我做错了什么。

我已经尝试过将文件名作为文本文件使用,但还是没有运气。

最佳答案

对于历史,是否可以帮助某人。对我来说,问题在于密码短语。有一个额外的字符(回车),它使制动 key 进入并显示此错误

09-27 07:30