SFTP connection with SSH2 mode

I need to to make an SFTP connection to an SFTP site with the SSH2 mode using Java code in PL/SQL developer.
And the connection requires an RSA key to start with. We got the RSA key, but I have some trouble with the code.
Below is the code I've got so far, and I don't know how to turn on the SSH2 mode, and I don't know how to include the RSA key:
public static void SFTP_Login (java.lang.String inSite, int inPort, java.lang.String inUser_ID, java.lang.String inPassword)
throws Exception
System.setProperty("java.net.preferIPv4Stack", "TRUE");
try
conn = new Connection(inSite, inPort);
conn.connect();
String[] auth = conn.getRemainingAuthMethods(inUser_ID);
boolean tKeyboardInteractive = false;
boolean tPasswordAuthentication = false;
int i;
for (i = 0; i < auth.length; ++i)
if (auth.equals("password")) {
tPasswordAuthentication = true;
} else if (auth.equals("keyboard-interactive")) {
tKeyboardInteractive = true;
boolean isAuthenticated = false;
if (tPasswordAuthentication) {
isAuthenticated = conn.authenticateWithPassword(inUser_ID, inPassword);
} else if (tKeyboardInteractive) {
ki.response = inPassword;
isAuthenticated = conn.authenticateWithKeyboardInteractive(inUser_ID, ki);
if (isAuthenticated == false)
throw new IOException("Authentication failed.");
catch(Exception ex)
SFTP_Logout_JAVA();
throw(ex);
}

Thanks for your answer..
There is nothing to keep secret from, But I just didn't get more detailed error message than this:
ORA-29532: Java call terminated by uncaught Java exception: java.io.IOException
I really wish I was able to get more specific error msgs, so that I can better debug the issue.
Do you know if connecting to an SFTP site using SSH2 mode with RSA keys need any special Java libraries?
In other words, maybe I need to Import other java libraries?
These are the ones I'm already importing:
import com.trilead.ssh2.Connection;
import com.trilead.ssh2.SFTPv3Client;
import com.trilead.ssh2.SFTPv3FileHandle;
import com.trilead.ssh2.SFTPv3DirectoryEntry;
import com.trilead.ssh2.InteractiveCallback;
import org.apache.commons.net.ProtocolCommandListener;
import org.apache.commons.net.ProtocolCommandEvent;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPConnectionClosedException;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.commons.net.ftp.FTPSClient;
import org.apache.commons.net.ftp.FTPFile;
Thank you,

Similar Messages

  • Making SFTP connection in SSH2 mode

    I need to to make an SFTP connection to an SFTP site with the SSH2 mode using Java code in PL/SQL developer.
    And the connection requires an RSA key to start with. We got the RSA key, but I have some trouble with the code.
    Below is the code I've got so far, and I don't know how to turn on the SSH2 mode, and I don't know how to include the RSA key:
    public static void SFTP_Login (java.lang.String inSite, int inPort, java.lang.String inUser_ID, java.lang.String inPassword)
    throws Exception
    System.setProperty("java.net.preferIPv4Stack", "TRUE");
    try
    conn = new Connection(inSite, inPort);
    conn.connect();
    String[] auth = conn.getRemainingAuthMethods(inUser_ID);
    boolean tKeyboardInteractive = false;
    boolean tPasswordAuthentication = false;
    int i;
    for (i = 0; i < auth.length; ++i)
    if (auth.equals("password")) {
    tPasswordAuthentication = true;
    } else if (auth[i].equals("keyboard-interactive")) {
    tKeyboardInteractive = true;
    boolean isAuthenticated = false;
    if (tPasswordAuthentication) {
    isAuthenticated = conn.authenticateWithPassword(inUser_ID, inPassword);
    } else if (tKeyboardInteractive) {
    ki.response = inPassword;
    isAuthenticated = conn.authenticateWithKeyboardInteractive(inUser_ID, ki);
    if (isAuthenticated == false)
    throw new IOException("Authentication failed.");
    catch(Exception ex)
    SFTP_Logout_JAVA();
    throw(ex);

    Duplicate of SFTP connection with SSH2 mode .

  • Can't establish a sftp connection with the finder

    Hi, I'm trying to establish a sftp connection with the finder (using the "Connect to server" feature) between my (recently purchased) Mac Mini (mid 2011: i5, 2.3 GHz, 2 GB, running 10.7.3) and a Debian Testing box and I can't, I get the following error:
    'There was a problem connecting to the server "ip.address"
    This file server will not allow any additional users to log on. Try to connect again later.'
    However if I try establishing a connection from the terminal (either ssh or sftp) it works flawlessly:
    SSH:
    victoria:~ RonIn$ ssh [email protected]
    [email protected]'s password:
    Linux clementine 3.0.0-1-486 #1 Sat Aug 27 15:56:48 UTC 2011 i686
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    You have new mail.
    Last login: Sat Apr 28 21:52:18 2012 from ukamy.local
    ronin@clementine:~$
    SFTP:
    victoria:~ RonIn$ sftp [email protected]
    [email protected]'s password:
    Connected to ip.address.
    sftp>
    I've searched for a fix or alternative on the internet and I haven't found one that works; The one that keeps coming up is to try: "ftps" as the protocol instead of "sftp" with the remaining information the same (it doesn't work, it gets the same error message afterwards).
    The IP address and login information works (corroborated by the fact that I can log in from the terminal from the Mac Mini) so the only issue is with the finder capabilities for establishing the connection. I have looked for apple related documentation or How Tos but I haven't found anything useful.
    I don't want to use any third party app or tweak because of the sensitive information that is going to be transfered, I would like to be using strictly the tools from the OS.
    If you need any more information please let me know, any help is deeply appreciated.

    I have the same issue although i kind of fixed it. I have two admin accounts and one of the account's safari did the same thing as yours, except, it was the startpage and everypage i tried to visit. I reseted safari, as in the erase all data safari in the toolbar, safari-Reset Safari... But safari still didn't work. I logged out and went to my other account and opened safari. Now it works fine on both accounts. This meant safari had to logout before actually working better. I have this a few times these days.

  • Architecture Limitations with Replication of VM connected with Physical Mode RDM

    what are Architecture Limitations with Replication of VM connected with Physical Mode RDM in vsphere replication. Why VMware is not supporting this?

    vSphere Replication does not work with physical mode RDMs. This is because of the way that vSphere Replication and physical mode RDMs work.
    As outlined in this: VMware KB: Difference between Physical compatibility RDMs and Virtual compatibility RDMs
    It isn't currently possible for VR to do what it needs to do with physical mode RDMs.
    Does this answer your question?

  • Update doesn't work - goes into a continuous "connecting with server" mode. Asked before, no response. HELP!

    Each time the 'update' icon comes up (for months, now), I click to update. It never goes beyond 'connecting with update server' mode. Have never had this problem with updates to new versions before. This happens every single time the update icon comes up.

    If you have problems with updating or with the permissions then easiest is to download the full version and trash the currently installed version to do a clean install of the new version.
    Download a new copy of the Firefox program and save the DMG file to the desktop
    * Firefox 5.0.x: http://www.mozilla.com/en-US/firefox/all.html
    * Trash the current Firefox application to do a clean (re-)install
    * Install the new version that you have downloaded
    Your profile data is stored elsewhere in the Firefox Profile Folder, so you won't lose your bookmarks and other personal data.
    * http://kb.mozillazine.org/Profile_folder_-_Firefox

  • No 3G background connection with "green mode" acti...

    Hi all,
    I just updated to PR 1.1 and very happy with it. But I have a little problem with the 3G connection. I'm always on "green mode", to save my battery life. Before update, when I had to use 3G connection, it connected to 3G without asking me which network to use... and that was great. But now, it asks me, every time I launch Mail app, Twitter or Facebook, instead of connecting itself to 3G.
    I checked in the settings : Background connection is activated...
    Thanks for your help !

    Go to settings...then internet connection then go to Edit networks and select the 3G connection (which you want your phone to connect to it automatically) and then click on "Use automatically" option thats it

  • Load-balancing inbound sftp connections with ACE

    Hi,
    Can anyone share experiences or any info relating to issues that might be encountered when load-balancing sftp protocol?
    The goal is to distribute inbound file deposits evenly across SFTP servers.
    High-level Overview
    Clients -> Internet -> Tier-1 Firewall -> ACE Load-balancer -> SFTP Servers
    Many Thanks

    SFTP is nothing but SSH. It uses a single connection. There are no issues loadbalancing it using traditional Layer 4 load balancing.
    So you are good.
    On the other hand FTP over SSL (FTPS) can neither offloaded nor loadbalanced using ACE.
    FTPS uses multiple channels and Since the control channel is encrypted, ACe is not able to get the port numbers for the data connections.
    HTH
    Syed Iftekhar Ahmed

  • Error when creating connection with SSO Authentication mode

    Hi All,
    when I am creating the connection with Authentication Mode as SSO, I get error "Unable to connect to SAP BW Server User abc has no RFC Authorization for function group SYST".
    When I am craeting connection with specific user id and Password it works fine.
    Pls. let me know whats the problem with creating connection with SSO.
    System Info: BOXIR.3.1 Sp3, SAP 7.1
    Regards,
    Nisha

    Yes, I have installed Integration Kit, and configured the SSO.
    I am able to login into designer with Authentication as SAP.
    But, the Problem is with connection creation with SSo authentication mode.
    Is there any property or role needs to be defined for the universe designer Group or user, so that SSO is allowed in authentication mode?
    Regards,
    Nisha

  • CFFTP SFTP Connection problems - CF8

    I have run into a brick wall trying to make the secure
    connection.
    My code is as follows
    <cfftp action = "open"
    username = "MyUser"
    connection = "MyConnection"
    password = "MyPassword"
    fingerprint = "fi:ng:er:pr:in:th:er:e"
    server = "IP Address"
    port="22"
    secure = "yes">
    I have confirmed the fingerprint (technically not required)
    and the port.
    Using FileZilla and the same parameters, I can make the SFTP
    connection with no problem.
    Yet in CF8 on my CrystalTech hosted account, I can't. I am
    working with their support team, but have been unsuccessful for
    several days.
    Has anyone actually ever done this in real life? I am falling
    days behind on this project.

    As it turns out, the webhost serving CF8 (CrystalTech) has
    blocked port 22 traffic. Port 22 is the standard port for SFTP
    traffic. I am working with the support team there trying to get
    them to permit traffic on this port. It doesn't look hopeful. I
    have now lost a good 20+ days on this issue.
    Does anyone have a workaround for using SFTP in CFFTP on a
    CF8 server? Need to move a file from the CF8 server to a different
    server - different location... securely.

  • Office 2013 - Word cannot establish a connection with this document after the system resumed from suspend mode

    Hiya!
    This issue has been answered numerous times for Office 2010 and Office 2007, but I have yet to any solutions or Hotfixes that work for Office 2013 (x64) on Win7.
    How to replicate the issue:
    Open a file from a network share.
    Edit file.
    Leave computer on with file open. Computer goes to sleep or into stand-by mode.
    Wait a bit
    Wake up computer
    CPU opens file in Read-Only mode and gives you the following error "Word cannot establish a network connection with this document after the system resumed from suspend mode. Save the document into a different file to keep any changes."
    What I've tried:
    http://support.microsoft.com/kb/2434898 - Office 2007 registry fixes. Does not apply.
    http://support.microsoft.com/kb/2413659 - Office 2010 problem. This exact issue. Says 'No microsoft products that match this hotfix are installed'
    Work Around:
    I can saving new versions of these files overrides this issue, but this is sometimes not possible for end-users who only have specific access to ONE SPECIFIC FILE in a particular network share.
    Please let me know how I can alleviate this issue!
    Thanks
    -Chris

    Hi,
    Are those problematic documents created via previous versions of Office?
    Please also try to run a repair of your Office 2013 installtion and check if it helps. See:
    http://office.microsoft.com/en-in/excel-help/repair-office-programs-HA010357402.aspx
    Regards,
    Steve Fan
    TechNet Community Support

  • Im having problems with my iPod Touch 2nd gen. It's disabled and tells me to connect to iTunes. But when I do that, iTunes wont detect the iPod.I have put the iPod in USB- mode, and by that I mean I have tried connecting with holding the home button Help?

    It's disabled and tells me to connect to iTunes. But when I do that, iTunes wont detect the iPod.I have put the iPod in USB- mode, and by that I mean I have tried connecting with holding the home button when connecting the USB. Help?

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                         
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: Back up and restore your iOS device with iCloud or iTunes       
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        
    If problem what happens or does not happen and when in the instructions? When you successfully get the iPod in recovery mode and connect to computer iTunes should say it found an iPod in recovery mode.

  • Problems to connect with VNC to headless mac mini after sleep mode

    Hallo,
    I've a Mac Mini (late 2009) setup with Lion Server. I want to use it without mouse/keyboard/monitor attached. Since I want to safe power ( green IT ;-) ), I would like to use sleep mode.
    First thing I've learned is, that Lion Server prevents the mini to go to sleep after an idel time as set in power saving.
    The only thing that works, is setting up a shedule with sleep / wakeup times.
    When I start the mini, everything works great. I can connect via VNC. The Mini goes to sleep at the scheduled time and wakes up again as expected.
    From this time on, things begin to get strange:
    I can connect using VNC, but all i get is a grey screen with a moving cursor. So VNC is working, but there is no screen available on the Mini. Same if I use thightVNC from a Windwos PC. Get a grey screen.
    Further the system does NOT go to sleep at scheduled times any longer.
    I was able to track down the problem to the missing monitor: If the Mini wakes up without a monitor connected, I seems to wait to get the right resolution or what ever. All servives are working, SSH is fine even VNC works, but shows only a grey screen.
    I've been playing with attaching / detaching a monitor. Sometimes I got:
    - Boot with monitor
    - connect with VNC, see login screen
    - send Mini to sleep
    - disconnect monitor
    - wakeup Mini
    - VNC reconnects, showing grey screen
    - plug in monitor and wait until login screen appears on the monitor
    - VNC switches from grey to login screen
    The only way I can save some energy is a sheduled shutdown / restart. So headless works, but not after waking up from sleep.
    Any hint or solutions for this ?
    Thanks
    Marc

    Look in the security feature.  This is a link to the FAQ (step 6):  http://support.apple.com/kb/PH4014?viewlocale=en_US
    I had the same issue when I connected my Mac Mini to be a Media Server.
    /r
    C.

  • SFTP connection issue with Dreamweaver 2014

    I have a very weird SFTP connection issue with Dreamweaver CC (2014). I am on a Mac running 10.9.4 and have no problem connecting to my server through SFTP with Dreamweaver CS 6. However, using the exact same settings on CC (2014), I get the following error: "An FTP error occurred - cannot make connection to host. Your login or password is incorrect. Please check your connection information".
    I am truly at a loss here. Command line connection works without problems.
    Any thoughts?

    Hi there,
    Try after rebooting your system or in a different user account on MAC.
    Is there any limit with number of login sessions with your SFTP?
    Could you check with Filezila or similar FTP client and connect to your site, see if you get any error there?
    Thanks.

  • HT4623 I attempted to update my phone without realizing that I needed to sync the phone with my  laptop. I am not home and my laptop is in another state. My phone is stuck in the "connect to iTunes"  mode and I now cannot use the phone. Can this be undone

    I attempted to update my iPhone 4 without realizing that I need to sync it with my laptop. My iPhone 4 is now stuck in the connect to iTunes mode and now I cannot use it.  Is there a way to reverse this so I can use my phone because I do not have my computer with me?

    Maybe it was hacked before and now through the update it's locked back to the original carrier.

  • Error in Remote Connect Oracle with MTS Mode

    I've configed my database to run MTS.
    My db is 8.1.5 with x86 Unix SunOS 5.7
    If I connect db through local area network, I can connect it with MTS mode.
    But if I try to connect db from a remote site, I can't connect and the following error shown :
    ERROR:
    ORA-12545: Connect failed because target host or object does not exist
    By adding a clause (SERVER = DEDICATED) in my remote client's tnsnames.ora
    I can connect it.
    Rgds,
    Edward
    The following is my configuration.
    init.ora :
    mts_dispatchers = "(PROTOCOL=TCP)(DISP=3)"
    mts_dispatchers = "(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)"
    mts_servers = 1
    mts_max_servers = 40
    mts_max_dispatchers = 4
    listener.ora :
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = QQQQdb)(PORT = 1521))
    (DESCRIPTION =
    (PROTOCOL_STACK =
    (PRESENTATION = GIOP)
    (SESSION = RAW)
    (ADDRESS = (PROTOCOL = TCP)(HOST = QQQQdb)(PORT = 2481))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /u01/app/oracle/product/8.1.5)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = QQQQdb.net)
    (ORACLE_HOME = /u01/app/oracle/product/8.1.5)
    (SID_NAME = QQQQdb)
    tnsnames.ora :
    QQQQDB =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = QQQQdb)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = QQQQdb.net)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    null

    I have run into the same problem using oracle 8.1.6.1 with redhat 6.2..
    I have found out that only when I specify host ip in the mts_dispatchers the mts will work correctly..(specifying host domain name is no use)
    Here is a sample of the configuration, hope that helps..
    mts_dispatchers = "(address=(protocol=tcp)(host=192.168.0.1))(dispatchers=4)"

Maybe you are looking for