As a requirement in a customer project is to support FTP over SSH I'm currently looking for 2 things:
1. A SecureFTP-Server for testing purpose
2. A Java library which supports FTP over SSH.
When searching for a solution the main problem is that ALL implementations are also transfering the files encrypted (and therefore implementing SSH FTP) - this is NOT what I'm looking for. As described here (http://de.wikipedia.org/wiki/Secure_File_Transfer_Protocol - german only) only the authentication and file listing should be encrypted - the file transfer itself is not encrypted.
Please don't try to convince me to use SSH FTP (or other secure protocolls like FTPS) - I need to use the more insecure version as the customer uses it...
EDIT: FTP over SSH exactly describs what I'm searching for.
If FTP over SSH is what you're after, one of the projects mentioned at the Wikipedia page on FTP over SSH is FONC, which is both a client and a server, written in Java, and licensed under GPLv2.
This looks like what you're looking for, check if the license is applicable to your project.
Related
I am trying to develop a desktop based application which will have a browse button. Once a file is selected by "Open File" dialog. The file should be sent to server(target) machine.
I am unsure of how this can be achieved in java. After searching through internet i found out that. This may be achieved in different ways. Some of them
Use FTP commands.
Socket Programming.
Third party library.
I do not want to use option 1 i.e., FTP because of security. Kindly guide on how this can be achieved ?
If you would like to use FTP, but it does not fit your needs concerning security, you could switch to Secure FTP (sFTP).
A library offering SFTP file transfer for Java is JSch. Example code for an sFTP transfer and even for a secure copy (scp) is available on the JSch webpage.
I would like to connect with an SFTP client to an FTP server using java. I know the two technologies have nothing to do with each-other. What I'm trying to accomplish is to connect to an FTP server via the internet with out using two ports or changing the server configuration.
Is there any SFTP->FTP bridge in java it would be great. If not, how can I accomplish that ?
I would like to incorporate this in an exciting java server so hence, java based solutions are preferred. If there is some standalone software which you can control via code than it should support windows and *nix.
(Since SFTP is just the means here, a similar WebDav solution will also work)
You could go with trial and error. Try this out see if it works.
How to retrieve a file from a server via SFTP?
I'm currently investigating for a client a solution where he wants to send and receive files using sftp in Domino.
I have looked on the net for API's covering this and found one recommended more than others; JSch.
One reason for choosing this API is for its use by others including Eclipse.
What I'd like to know is:
if there're any obsticales using this Library? If so, can you recommend any other?
are there any other caveats using sftp in Domino Java?
does Domino JVM support JavaTM Cryptography Extension (JCE)?
can we use Dominos self-signed certificates here, with Dominos CA?
/Mike
1) Sending. This should work, but you will probably have to deal with the JVM's Security Manager ("/jvm/lib/security/java.policy") of Domino to get a socket, ...
2) Receiving: You probably don't want to implement a SSH server inside domino. It's much easier and more secure to use the SSH server of the host and periodicaly scoop up the inbound files via an Agent.
Dominos Self Signed SSL certificates have nothing to do with SSH as implemented by JSch.
3) The Domino JVm will probably support theJavaTM Cryptography Extension (JCE). Watch out for the supported JRE versions of Domino.
4) Generally: Are you sure, you want to implement it that way? Probably way easier are either WebServices or a REST-API, both via SSL/TLS and optionally facilitating client certificates.
I'm writing a program in Java using the sockets to communicate with a Telnet server which allows the users to access the file directory in an UNIX OS.
When using Putty to communicate with this server, it prompts me for my username and password, but using my sockets there is nothing from the server except for a string which states that it uses SSH 2.0 - I think.
I'm sure that this has to do with the Telnet protocol, but how do I get the server to ask me for my username and password. What set of commands would I need to give the server in order to access the file directory in an UNIX environment?
Correction:
I figured that it's actually using SSH on port 22. It can be accessed using Putty or Microsoft Windows' Telnet program, but it doesn't actually use the Telnet protocol but the SSH protocol.
SSH isn't telnet. SSH is a protocol that is a lot like telnet, but is encrypted and has a slew of other features. So it looks like youre expecting a plain-text exchange, but what you're getting is the ssh protocol trying to do a handshake.
Telnet runs on port 23, SSH on 22. I imagine you want to use 23. Note: Telnet is old and unencrypetd and dangerous to use over the internet (unless youre going over a VPN or something that encrypts the session).
There is really nothing to the Telnet protocol for most uses...see this page for details. If the server on the other end is trying to negotiate a SSL connection, which is by far the most likely thing these days, try using a java.net.ssl.SSLSocket instead of a bare TCP socket.
Once you negotiate the connection (see the docs linked above) you should essentially print UNIX CLI commands to the socket and read (& parse) the results. If you just want to access files, maybe use FTP instead. Most modern servers are going to support SFTP.
Edit
With a little poking I found that using SSLSocket directly to connect to a SSH server is cumbersome at best because SSH has its own protocol. You probably don't want to reinvent the wheel on that one. Check out the answers to this question for some pure Java SSH client libraries. You can probably use at least one of these to solve your problem more directly than sending text commands over SSH.
Would it be a telnet server, it would be simple.
But what you have is a ssh server, and that is good as it is. telnet is heavily deprecated, as it is not encrypted.
You now have two options: Either use a ssh library or access the ssh command line client (or under Windows: the plink program) via its stdio.
I want to access to a file (read) that exist on a remote machine from my code JAVA,what I need to do that?
just the IP of the machine and the location of the file or I need somthing else?
Thank you
There are some choices:
Via a 'mapped' directory using SMB/Samba to the remote machine and you can then access the file using the normal File class.
Via a Web Server where read access is easier (if you require write access then you are looking at something like WebDAV). This requires the use of the HTTP protocol in your code.
Via FTP or SFTP network protocols to access the file. This obviously requires the use of (S)FTP classes to access the file.
The first option is easiest from a coding point-of-view.
If both the Java code and the remote file are on Linux machines, you can also choose NFS.
As always you need to start a server which serves the file - you need nfsd to share the directory containing that file on the remote machine.
On the machine where your Java code will run, mount the shared nfs
Here is a brief introduction of using nfs on Ubuntu.
If you prefer FTP/HTTP, you will be interested in Apache commons vfs library, which supports many protocols including FTP, SFTP, HTTP, etc.
First of all, you need a service on the remote machine that serves files. Once a file-serving service exists, you communicate with the service using its protocol.
Assuming the client-server model, you have several choices on the remote (server) side. First of all, you can design your own protocol, write a server, deploy it on the remote machine and write a client (in Java) which will talk with the server using the designed protocol. However, there many off-the-shelf solutions (protocols + servers + Java client libraries) that might be used. Three protocols which come to mind right now: TFTP, FTP and SMB.
If your aim is simplicity, I recommend TFTP: there are free TFTP servers for UNIX, Windows and Mac OS X, and there is Apache Commons Net Java library on the client side.