how to setup sftp
# ask-stanley-ai
b
how to setup sftp
c
AI generated answer (using internal Slack threads):
To set up SFTP in NetSuite, you can use the SFTP module with private keys. Here are the steps: 1. Upload your private key to NetSuite by going to Setup > Company > Keys. 2. Use the
sftp.createConnection()
function to create a connection. Set the
keyid
field to the internal id of your previously uploaded key. Here's a sample code snippet:
Copy code
javascript
var sftp = require('N/sftp');
var connection = sftp.createConnection({
    username: 'myUsername',
    passwordGuid: 'myPasswordGuid',
    url: 'myUrl',
    hostKey: 'myHostKey',
    directory: 'myDirectory',
    keyId: 'myKeyId' // the internal id of your previously uploaded key
});
For testing your SFTP script, you can use cloud-based servers like Files.com or Rebex. If you're comfortable with Linux, you can also create your own SFTP server. If you're on Windows, Solarwinds has a Windows-based server that's easy to set up. If you're getting the
FTP_INCORRECT_HOST_KEY
error, you can use the
ssh-keyscan
command to get the correct host key. Here's how: 1. Run
ssh-keyscan <http://website.com|website.com>
in your command prompt or terminal. 2. Copy everything except
ssh-rsa
. Here's a sample command:
Copy code
bash
ssh-keyscan -p [portnumber] <http://website.com|website.com>
Replace
[portnumber]
with the port number provided by your SFTP server. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836364567
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.8219347
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820612788
Please provide your feedback on this answer.