Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9146723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:48:54+00:00 2026-06-17T10:48:54+00:00

Jsch, private.ppk based login. Currently i have following code to ssh login but getting

  • 0

Jsch, private.ppk based login.

Currently i have following code to ssh login but getting exception due to does not provide key.

Following is my error i am getting

om.jcraft.jsch.JSchException: Auth cancel


 JSch jsch = new JSch();
        Session session = jsch.getSession(user_name, host, 22);


        UserInfo ui = new SSHUserInfo(password, true);
        session.setUserInfo(ui);
        //connect to remove server
        session.connect();

        //sudo login bamboo
        if (null != session && session.isConnected()) {
            session.disconnect();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:48:55+00:00Added an answer on June 17, 2026 at 10:48 am
    JSch jsch = new JSch();
    
    // Here privateKey is a file path like "/home/me/.ssh/secret_rsa "
    // passphrase is passed as a string like "mysecr"
    jsch.addIdentity(privateKey, passphrase);
    
    session = jsch.getSession(user, host, port);
    session.setConfig("StrictHostKeyChecking", "no"); 
    // Or yes, up to you. If yes, JSch locks to the server identity so it cannot
    // be swapped by another with the same IP.
    
    session.connect();
    channel = session.openChannel("shell");
    out = channel.getOutputStream();
    channel.connect();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code that uses JSch to create an SSH connection: public class
In the following code below i have importted the jsch jar by clicking on
I have the following block of code, which uses the JSCH library found at
The jsch based implementation works for me. But it looks not modern one due
I'm trying to use Jsch to establish an SSH connection in Java. My code
I have CoreFTP configured for localhost and the next code: JSch.setLogger(new MyJschLogger()); //class for
I am using Jcraft library to connect with SSH, I have done the code
I'm using JSch to get files from an SFTP server, but I'm trying to
I am trying to connect to remote sftp server over ssh with JSch (0.1.44-1)
I would like to access (clone/push/pull) a private (via ssh) git repository while behind

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.