SFTP support
843790Dec 8 2008 — edited Dec 8 2008Hi All,
I need a functionality that can connect to a SFTP (Secure FTP) server and upload files to it.
"SFTP (Secure File Transfer Protocol) is a secure replacement for FTP (File Transfer Protocol) based on the Secure Shell protocol. Unlike FTP, SFTP encrypts both commands and data providing effective protection against common network security risks."
I want to know is there any package available in Standard JSDK using which I can do the same. Earlier I was doing plain FTP that I did using socket communication and issuing FTP commands.
I first connect to the FTP server on the default port 21.
I get an InputStream and OutputStream from the socket.
Then I use following commands to upload file in Passive mode:
Login to the server using USER and PASS command then,
1. issue "TYPE I"/"TYPE A" command for BINARY/ASCII mode. Read response.
2. Issue "STOR "+remoteFileName command. Read response.
3. Write all file data to the output stream in chinks.
4. Close the socket.
This was pretty simple. Now I want to connect to SFTP server and I want to know if there is a similar way to do the same.