Archived Forum Post

Index of archived forum posts


FTP Command inside SSH?

Jun 22 '12 at 17:02

I tried to implement SSH function using your lib for iphone and wondering if its already fully supporting ftp commands. I found that when I execute command just like this : ssh > ftp > open (hostname) it returns a "command not found" message.


This clarification regarding FTP and SSH/SFTP may help:

"SFTP" is the Secure File Transfer Protocol over SSH. It is a protocol unrelated to the FTP protocol. The Chilkat SSH / SFTP component is used for "SFTP". SFTP is achieved by connecting to an SSH server at port 22.

On the other hand, the Chilkat FTP2 component is for FTP. FTP servers listen at port 21 (non-SSL/TLS) and port 990 (SSL). FTP over SSL (i.e. port 990) is called "FTPS".


It sounds to me like you're starting an SSH shell session via the SendReqShell method. Once the session begins, it's like typing at a terminal. When a string is sent via the ChannelSendString method, it's just like you typed it at an interactive terminal. That's why you need an LF (or CRLF) at the end of your command string. The remote shell executes the command, and any output is sent back over the session channel, which your program receives via the various ChannelRead and ChannelReceive methods.

When you send the "ftp" command, you're starting an interactive FTP session in the remote shell. (Note: This has nothing to do with Chilkat FTP2. It's the interactive FTP command available on any Linux/Unix operating system.) The output you'll get back is the FTP command prompt. You may then issue FTP commands and of course get the output from those commands, until you finally issue the "quit" or "exit" command (whichever it happens to be), and then you're back at the remote shell prompt, etc..