N/SFTP模块中的文件传输协议不正确主机密钥 [英] FTP_INCORRECT_HOST_KEY in N/SFTP Module

查看:31
本文介绍了N/SFTP模块中的文件传输协议不正确主机密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用N/SFTP模块创建从NetSuite到SFTP的连接时,我遇到错误状态:

"文件传输协议不正确主机密钥","消息":"提供的主机密钥不匹配 远程服务器的指纹。"

我已尝试与服务器团队核实,但无济于事。是否有人能建议我如何解决此问题,或者如何从服务器获取授权的指纹主机密钥。

我在下面提到的工具的帮助下尝试了Suitescrip 2.0模块(N/SFTP)。

https://ursuscode.com/netsuite-tips/suitescript-2-0-sftp-tool/

/**
 *@NApiVersion 2.x
 @NScriptType ScheduledScript
 */
define(['N/sftp', 'N/file', 'N/runtime'],function(sftp, file,runtime) {  

    function execute(context)
    {
        var myPwdGuid = "Encrypted password by GUID";
        var myHostKey = "Some long Host key around 380 characters";

        // establish connection to remote FTP server
           var connection = sftp.createConnection({
            username: 'fuel_integration',
            passwordGuid: myPwdGuid, // references var myPwdGuid
            url: '59.165.215.45',//Example IP
            directory: '/sftproot/TaleoSync',
            restrictToScriptIds : runtime.getCurrentScript().id,
            restrictToCurrentUser :false,
            hostKey: myHostKey // references var myHostKey
           });
        // specify the file to upload using the N/file module

        // download the file from the remote server

        var downloadedFile = connection.download({
            directory: '/sftproot/TaleoSync',
            filename: 'Fuel Funnel Report_without filter.csv'
        });
        downloadedFile.folder = ;
        downloadedFile.save();

         context.response.write(' Downloaded "Fuel Funnel Report_without filter" to fileCabinet');

    }

    return {
        execute: execute
        };


});

我希望在SFTP和NetSuite之间创建连接,以便从SFTP中取出文件并将其放置到NetSuite文件柜。

推荐答案

几件事:

restrictToScriptIds : runtime.getCurrentScript().id,
restrictToCurrentUser :false,
不是createConnection签名的一部分。当您创建Suitlet来保存您的凭据时,应该使用这些工具。

但是,可以通过在Linux机器上使用ssh-keycan来处理主机密钥投诉。

ssh-keyscan  59.165.215.45
应使用服务器名、ssh-rsa和较长的Base64字符串进行重播。复制该字符串,使其以myHostKey结束,并将host KeyType设置为RSA。

这篇关于N/SFTP模块中的文件传输协议不正确主机密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆