7 Replies Latest reply: Apr 16, 2013 10:15 PM by p4predator RSS

    Windows SFTP

    p4predator
      Hi Guys,
      I would like to explain my requirement and hope that someone can help out here. Thanks in advance.

      Our application is running on Windows 2008 server. We have several Windows command script that transfers file using SFTP through Tectia ssh client installed on the Windows server. However it is unstable and we are looking to migrate these SFTP transfers to Java.

      Using Windows command "sftp2 user@servername:directory_path", we transfer the files without password and providing the key path.

      To use SCP / SFTP in Java, is it possible to transfer files using username, host, port alone? I do not know the password and private / public keys are already installed on our servers and also on the client servers for an authenticated communication. If still keys need to be used on Java program then how it should be used?

      I went through some articles about using JSch but didn't help me understand how to use the private / public key that are already installed on the servers.

      Thanks.
        • 1. Re: Windows SFTP
          aksarben
          Jakarta Commons (http://commons.apache.org/proper/commons-net/) advertises secure FTP support, if you haven't looked there yet...
          • 2. Re: Windows SFTP
            p4predator
            Thanks Aksarben. I will take a look.
            • 3. Re: Windows SFTP
              sabre150
              aksarben wrote:
              Jakarta Commons (http://commons.apache.org/proper/commons-net/) advertises secure FTP support, if you haven't looked there yet...
              I don't see an SFTP client on that site! Note that FTPS is not the same as SFTP !
              • 4. Re: Windows SFTP
                sabre150
                user8988272 wrote:

                Our application is running on Windows 2008 server. We have several Windows command script that transfers file using SFTP through Tectia ssh client installed on the Windows server. However it is unstable and we are looking to migrate these SFTP transfers to Java.

                Using Windows command "sftp2 user@servername:directory_path", we transfer the files without password and providing the key path.
                Then most likely the default key files for sftp2 are being used . SFTP sits on the top of SSH and SSH derives it's security through the use of passwords and/or public key cryptography so you must be using one or other or both of these methods.

                >
                To use SCP / SFTP in Java, is it possible to transfer files using username, host, port alone?
                Of course not! This would have no security at all and I assume you are using SFTP because you need to transfer the files securely.
                I do not know the password and private / public keys are already installed on our servers and also on the client servers for an authenticated communication. If still keys need to be used on Java program then how it should be used?
                There are many Java SSH/SFTP libraries and Google will find them - JSch is the one I tend to use. For secure communication you will need to know the server's public key and you will need to use the current client private and public key keys.

                >
                I went through some articles about using JSch but didn't help me understand how to use the private / public key that are already installed on the servers.
                You need to spend more time learning about SSH/SFTP since the use of the private / public keys are fundamental to the operation of SSH/SFTP .
                • 5. Re: Windows SFTP
                  gimbal2
                  sabre150 wrote:
                  There are many Java SSH/SFTP libraries and Google will find them - JSch is the one I tend to use.
                  Same here.

                  And commons.net advertises "secure FTP", which is in fact FTPS. apache commons-vfs has SFTP support (through jsch) built in, but I really don't like that API.
                  • 6. Re: Windows SFTP
                    p4predator
                    Hi Sabre150,
                    Thanks for the details response. I'm going through JSch in a detailed manner to handle the scenario for me.

                    Thanks.
                    • 7. Re: Windows SFTP
                      p4predator
                      Thanks Gimbal2.