Question

SFTP knownhost file set-up error

  • 25 August 2020
  • 7 replies
  • 1094 views

Userlevel 5
Badge +8

We are trying to create the knowhosts file required for SFTP communications between IFS and Pagero (our EDI vendor).  From IFS documentation, here is what we are supposed to do:

 

SFTP requires a "known hosts" file. The known hosts file contains the public key of the SSH2 server,
and the purpose of this file is to ensure that a server cannot maliciously impersonate another server
(e.g. man-in-the-middle attacks).
The known hosts file may already have been created by an SSH2 client and may be reused by an SFTP
reader. If there is no known hosts file or it is in an incompatible file format, a new known hosts file can
be created with the following command:
java -cp <IFS_HOME>\javaruntime\ifs-connector-sftp.jar;<IFS_HOME>\javaruntime\jsch-0.1.50.jar
ifs.fnd.connectserver.sftp.SftpCreateFiles -CreateKnownHosts=KNOWNHOSTS -
hostname=SFTPHOST -username=USERNAME -password=PASSWORD

 

I trying executing the command on our IFS application server and get errors, A JNI error has occurred…see below

I do not know JAVA very well, does anyone know what can be done to get this script working?

 

 


7 replies

Userlevel 7
Badge +20

It could be most probably due to the version of jsch jar. Check <IFS_HOME>\javaruntime folder whether you have a never version of this (jsch-0.1.53.jar) and if it’s present, change the command to use it.

java -cp <IFS_HOME>\javaruntime\ifs-connector-sftp.jar;<IFS_HOME>\javaruntime\jsch-0.1.53.jar
ifs.fnd.connectserver.sftp.SftpCreateFiles -CreateKnownHosts=KNOWNHOSTS -
hostname=SFTPHOST -username=USERNAME -password=PASSWORD

 

Hope it helps!

Damith

Userlevel 5
Badge +8

I tried the recommended change because the file does exist (jsch-0.1.53.jar) but now ran into a different error. 

When checking my <IFS_HOME>\javaruntime folder, I seem to be missing the following .jar file (ifs.fnd.connectserver.sftp.SftpCreateFiles).  

Could that be the issue?  

Thanks, Mark

Userlevel 7
Badge +20

Hi Mark, ifs.fnd.connectserver.sftp.SftpCreateFiles is packed in ifs-connector-sftp.jar, so it should be available. Can you post the new error? may be the error stack says more ;)

 

Userlevel 5
Badge +8

This is the error I get now:

 


​​​

Any ideas what to try next?

Userlevel 7
Badge +20

There are two things I guess could wrong

  1. knownhosts file is not created.

run below command in cmd first and then run the command to create knownhost

fsutil file createnew E:\ifs\ifstest\knownhosts 0

 

  1. password contains & sign so cmd treat as two commands. Strongly suggest to change the password since this forum is public and make sure not to include & in the new password ;)

 

Cheers!

Damith

Badge +3

There are two things I guess could wrong

  1. knownhosts file is not created.

run below command in cmd first and then run the command to create knownhost

fsutil file createnew E:\ifs\ifstest\knownhosts 0

 

  1. password contains & sign so cmd treat as two commands. Strongly suggest to change the password since this forum is public and make sure not to include & in the new password ;)

 

Cheers!

Damith

Hi @dsj (Damith)!

 

Long time no see! On your point #2, you can escape ampersands (&) using the caret (^) character in DOS (command prompt on Windows.) Just put the caret right before the & in the password and the knownhosts files should be generatable.

 

Regards,

Randy

Userlevel 6
Badge +14

Hello

@dsj 

@EntRandyG 

@svrmhuebner 

 

I read the entire post I was wondering if the issue was resolved ? 

 

Thanks,

JL

Reply