2

I'm logged into a Linux server and use ftp placeftp.thing.com to connect to a different server.

I receive the message below and now I can transfer files to that server, however a basic Unix command echo $SHELL doesn't work. Is it because I'm in binary transfer mode or simply because of the FTP connection?

Connected to placeftp.thing.com (12.10.115.175).
220 You are connected to PLACEFTP.THING.COM.
331 User name okay, need password.
230 User logged in, proceed.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> echo $SHELL
?Invalid command

I might be asking my question incorrectly, but what am I misunderstanding about FTP connections?

1
  • Some FTP servers allow logged-in clients to execute commands on the server using the SITE FTP verb. It's unlikely to give you a shell-like environment with variables and so on - it's more likely implemented using a simple exec()/wait(). Commented Sep 1, 2017 at 7:54

2 Answers 2

22

FTP is not a remote shell like SSH or telnet. FTP is a protocol with only a few select commands. See the standard RFC 959 for details about the supported commands.

The various terminal interfaces which exist and the various graphical FTP clients essentially just translate some local commands or clicks into a FTP command. For example many terminal clients have ls or dir which will be translated in FTP LIST command, put into STOR, get into RETR etc. But there is no FTP command for an echo functionality you've tried because such functionality does not really make sense when the single goal of the protocol is file transfer.

2
  • 1
    Note that at an interactive, TUI, FTP client like that, the user is not actually speaking the FTP protocol, and what commands the protocol has is not the same as what commands the client software has. Commented Aug 31, 2017 at 19:50
  • @JdeBP: correct. I've extended the answer to make this more clear. Commented Aug 31, 2017 at 19:59
6

FTP is used to transfer files between computers on a network. When you connect to a FTP server, you are able to run commands that help you transfer, create, and remove files.

It is not a bash shell that you can run bash commands on.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.