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 7737385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:58:59+00:00 2026-06-01T07:58:59+00:00

I am using JSch library to upload file from sdcard to SFTP server but

  • 0

I am using JSch library to upload file from sdcard to SFTP server but it’s generate such error

04-04 14:29:02.609: W/System.err(10706): 3: Permission denied
04-04 14:29:02.609: W/System.err(10706):    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2289)
04-04 14:29:02.609: W/System.err(10706):    at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:485)
04-04 14:29:02.609: W/System.err(10706):    at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:389)

My code is

public class FileUploadActivity extends Activity {
/** Called when the activity is first created. */
Channel channel = null;
ChannelSftp c = null;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.downloadmain);

    final String host="192.***.*.**";
    final String username="*****123";
    final String password="****123";
    try {
        Session session=connectSFTP(host, username, password);
        channel = session.openChannel("sftp");
        channel.connect();
        c = (ChannelSftp) channel;
        c.cd("/home/*****11/doc");
        String inputFileName =Environment.getExternalStorageDirectory().getAbsolutePath()+"/demo/enck.pdf";
        File f = new File(inputFileName);  
        c.put(inputFileName, "/home/*****11/doc/enck.pdf");
    } catch (Exception e) {
        // TODO: handle exception
        System.err.println("Unable to connect to FTP server."
                + e.toString());
        e.printStackTrace();
    }
}
public Session connectSFTP(String host,String username,String password){
    Session session= null;
    try{
        JSch js = new JSch();
        session = js.getSession(username, host, 22);
        session.setPassword(password);
        java.util.Properties config = new java.util.Properties();
        config.put("StrictHostKeyChecking", "no");
        session.setConfig(config);
        session.connect();          
    }catch (Exception e) {
        // TODO: handle exception
        Toast.makeText(getBaseContext(), "Unable to connect Your SFTP Serve"+e, Toast.LENGTH_SHORT);
    }
    return session;
}
}
  • 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-01T07:59:00+00:00Added an answer on June 1, 2026 at 7:59 am

    Obvious things to check:

    • Does your application have permission to read from the SD card?
    • Does the user you’re logging in with have permission to write to that destination?

    From the location of the exception, I deduce that you do have permission to access the internet, but that’s also worth double-checking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using JSch to get files from an SFTP server, but I'm trying to
The applet will download file from a SFTP server. JSch libraries are used to
I am using JSCH library to do a sftp between two servers. But, I
I'm using Jsch 0.1.44 to scp a file from one host to another. The
I am using a jsch library to connect to a server using ssh connection.
i am using jsch to get ssh output from a local ssh server. When
I'm currently using JSch as the library for connecting to my remote server. In
Using the library to connect to a remote server and copy a file. I
I'm looking at setting up public key client and server authentication for SFTP using
Is it possible to do file/directory sync in Java using JSch ? I need

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.