Menu

unable to put file using sftp

Help
pink123
2012-06-01
2013-05-28
  • pink123

    pink123 - 2012-06-01

    I am using the below code to connect and put the file under sftp server

    public void SFTPPutFiles()

    {

    Sftp SFTPConnection = null;

    try

    {

    SFTPConnection = new Sftp(_FTPServer, _FTPUserId, _FTPPassword);

    SFTPConnection.Connect();

    SFTPConnection.Put(_LocalFilePath);

    }

    catch (Exception ex)

    {

    clsError.WriteError("SFTPPutFiles", ex);

    }

    }

    I am geting the below error when I try to run the exe with the parametrs ftp server name,userid,password and the local file path

    Error Message: Exception of type 'Tamir.SharpSsh.jsch.SftpException' was thrown.
    Error Stack:    at Tamir.SharpSsh.jsch.ChannelSftp.put(String src, String dst, SftpProgressMonitor monitor, Int32 mode)
       at Tamir.SharpSsh.Sftp.Put(String fromFilePath, String toFilePath)
       at Tamir.SharpSsh.Sftp.Put(String fromFilePath)
       at SFTPClient.clsFTP.SFTPPutFiles()

    It looks like there is some problem with the put function.Is it due to some user rights.

    This use to work fine before till the sftp site changes and I had to change the
    sftp sitename and credential.Please help

     
  • Anonymous

    Anonymous - 2012-06-29

    Hi,

    I was facing the same problem, but it is resolved when I set the correct

    Sftp sftpClient = new Sftp(SFTPHost, SFTPUser, SFTPPassword);
    sftpClient.Connect();
                   sftpClient.Put(filePath, remoteFolder);

    //remoteFolder  - /data/home/bsssftp/out/ 

     

Log in to post a comment.

MongoDB Logo MongoDB