Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
arpiitv
Contributor
Contributor

Error: com.jcraft.jsch.JSchException: Auth cancel

Hi Team,

I'm trying to establish SFTP connection using tFTPConnection component and I'm using auth type is Public Key but getting error Auth Cancel. But with the same creds I'm able login in WinSCP, so problem with component, Could someone please have look into it. Please.

Getting below error :

Error: com.jcraft.jsch.JSchException: Auth cancel

Labels (2)
21 Replies
Anonymous
Not applicable

​Hi @Arpit Verma​,

 

I am confused. You are saying you are using v7.3.1 and you do not have the option of using both a public key and password. Unfortunately I do not have access to a suitable FTP server to test this, but I have looked at the component and it seems to give you the option of using both. You can see that in this screenshot....

 

0693p00000BWcgeAAD.png 

Are you saying that filling in all of the fields shown here is not working? If that is the case it sounds different to David's case. I believe David's case was that he was not presented with all of the fields. It sounds like it may be a bug. Do you have a support license with Talend? If so, can you raise this with Support? If not, can you let us know and we will see if we can get this raised.

 

@Shicong Hong​ or @Xiaodi Shi​  can you raise this issue if @Arpit Verma​ does not have a support contract?

arpiitv
Contributor
Contributor
Author

@Richard Hall​ yes fulfilling all fields while using public key auth that is not working, I've attached the screenshot of ftp component and erros in above reply.

Also, as I'm getting Auth Cancel error so that's mean Authentication not Fullly ccompleted.

@Shicong Hong​ @Xiaodi Shi​ ​

arpiitv
Contributor
Contributor
Author

Here is Auth Cancel error I'm getting0693p00000BW3u7AAD.jpg0693p00000BW3u7AAD.jpg@Richard Hall​ @Shicong Hong​ @Xiaodi Shi​  Here is configuration of component 0693p00000BWiLSAA1.jpg 

 

 

 

arpiitv
Contributor
Contributor
Author

@Richard Hall​ @Shicong Hong​  Kindly take a look into this.

Anonymous
Not applicable

@Arpit Verma​ I have raised this as a bug. I am afraid that this might take some time for it to be actioned.

 

However, since this is clearly holding you up, I have decided to create a workaround. I have set up an SFTP server that I suspect is like yours. I have recreated the issue. I have also found a solution using Java. In order to use this in a Talend job you will need to use a bit of Java, but most of the hard work I have done for you. This a job that will list all of the files in a folder and at the end it will download one of them. I have done this so that you can have an idea of how to sort this for yourself.

 

This is NOT supported code and you should use it entirely at your OWN RISK!

 

An image of the job is below.....

 

0693p00000BWu8kAAD.pngIt is just two components. A tLibraryLoad component to load the jsch-0.1.55.jar library into the Job. The second is a tJavaFlex component. This allows you to cycle through files and do something per file if you wish.

 

The tLibraryLoad is shown below......

 

0693p00000BWuA2AAL.png 

That is all you need to do for that component.

 

The tJavaFlex's different code sections are shown below......

 

Start Code

**************************************************************************************************

com.jcraft.jsch.Session jschSession = null;

 

try{

com.jcraft.jsch.JSch jsch = new com.jcraft.jsch.JSch();

jsch.setKnownHosts("/Users/richardhall/known_hosts_new");

jsch.addIdentity("/Users/richardhall/.ssh/id_rsa", "mypassphrase");

jschSession = jsch.getSession("richard", "192.168.1.25", 22);

   jschSession.setPassword("mypassword");

 

   // 10 seconds session timeout

   jschSession.connect(10000);

 

com.jcraft.jsch.Channel sftp = jschSession.openChannel("sftp");

   // 5 seconds timeout

   sftp.connect(5000);

 

   com.jcraft.jsch.ChannelSftp channelSftp = (com.jcraft.jsch.ChannelSftp) sftp;

 

System.out.println(channelSftp.getHome());

java.util.Vector filelist = channelSftp.ls(channelSftp.getHome()+"/Documents");

       

  for(int i=0; i<filelist.size();i++){

 

**************************************************************************************************

 

What I am doing above is getting the connection, then printing the home folder, then getting a file list from the "Documents" folder and adding the values to a Vector. I then open a FOR loop to iterate over the Vector. The code to print the filenames, etc, is in the Main Code section.

 

Main Code

**************************************************************************************************

   com.jcraft.jsch.ChannelSftp.LsEntry entry = (com.jcraft.jsch.ChannelSftp.LsEntry) filelist.get(i);

  System.out.println(entry.getFilename());

**************************************************************************************************

 

The above code simply gets the file details and prints the filenames out one at a time. Remember that the Main Code section is run for every iteration of the For loop.

 

End Code

**************************************************************************************************

    }

    

   channelSftp.get(channelSftp.getHome()+"/Documents/hellotest.txt", "/Users/richardhall/Documents/hellotest.txt");

     

} catch (com.jcraft.jsch.JSchException e) {

e.printStackTrace();

} finally {

if (jschSession != null) {

   jschSession.disconnect();

  }

}

 

**************************************************************************************************

This code basically closes the For Loop opened in the Start Code section. I also demonstrate how to download a file (get). I then close down the try/catch block that I opened in the Start Code.

arpiitv
Contributor
Contributor
Author

@Richard Hall first of all, Thank you much for this code that you have written. Really appreciate it!!

Looks like I need to do add some additions in order to use this approach. But I was wondering if that workaround only happen with FTP component.

I'm trying another solution to achieve this to write shell script and call it by tSystem component, hope that works.

Please update about raised ticket status whenever you get. Thank you @Richard Hall​ !!​

Anonymous
Not applicable

Hi @Arpit Verma​ ,

 

This workaround should allow you to do anything you need with regard to the SFTP part of the process. In theory, it should actually allow you more freedom. You just need to look for Java examples to extrapolate from

arpiitv
Contributor
Contributor
Author

@Richard Hall​  Sure, Thanks!!

madhukolli2003
Contributor III
Contributor III

Hi @Richard Hall​ ,

I am facing same issue, are you able to fix it in the tftpconnection component level ?

 

Thanks & Regards,

Madhu Kolli

 

Anonymous
Not applicable

Hi @MADHUSUDHANA kolli​,

 

Sorry about the delay in responding to your question. I have checked on the progress of the case that I raised and I am afraid it has been treated as a feature request instead of a bug. The justification behind this does make sense, but it is frustrating. As such, I do not have an ETA for when this will be done.