Alessandro Aguiar
Alessandro Aguiar

Reputation: 61

NetSuite SuiteScript 2.0 SFTP - How to connect with private key

I'm trying to create a script that connects to a vendor system using SFTP.

But instead of providing me the password, they sent me a private key file (.ppk). I read some articles and following some instructions and I was able to convert it to '.pem' and import it to NetSuite on the Private Key page.

But now, I don't know how to load the key in the script and I couldn't find anything on the NS reference guide.

/********************* SFTP connection Logic *********************/ 
            
            var myPwdGuid = ''; //I don't know how to fill this field / No password was provided            
            var myHostKey ='' ;//I don't know how to fill this field
            
            var connection = sftp.createConnection({
                username: 'usr_ch_prd_client_CEN',
                passwordGuid: myPwdGuid,
                url: 'vendorserverurl',
                port: 22,
                hostKey: myHostKey,
                hostKeyType:'rsa'
            });
            

Thank you!

Upvotes: 0

Views: 2637

Answers (1)

bknights
bknights

Reputation: 15447

Instead of passwordGuid you need keyId

as for the host key see FTP_INCORRECT_HOST_KEY in N/SFTP Module

Upvotes: 2

Related Questions