I am not talking about shell programming or making a whole new shell like Bourne or Korn Shell....

I just want a user accessing ftp through port 21 to be directed to this shell which can support some of the basic commands a shell uses!

I Googled the very same...but didn't find any satisfactory results.

  • 5
    I don't understand the question. Is the user connecting with an FTP client? If so, the user will only be able to use commands supported in the FTP client; and the server had better implement the FTP protocol, otherwise it won't be able to talk to the client. Are you looking to extend the FTP protocol? Servers can define custom commands, but if you make your own the client won't support them and they'll be awkward to use. Jul 12, 2012 at 22:37

1 Answer 1


Usually, Korn and Bash shells have a "restricted shell" mode. Getting to a restricted shell might be as easy as typing rsh (avoid "remote shell" - definitely not a good idea in 2012) or rbash. But I'm not sure what you want.

The FTP protocol might allow a client to send arbitrary commands (with QUOTE), but the FTP server (ftpd) probably shouldn't just execute anything it gets. FTP servers have a long history of security problems, part due to the FTP protocol itself, part due to sloppy programming or subtle errors.

Using ftp (the client program) you might have the ability to do a file listing on the ftpd (server program) machine, or you might have the ability to get ftpd to change directories, but even if you assign a restricted shell to the user ID "ftp", you won't get the ftp client to do arbitrary things on the FTP server (the machine).

You might get what you want by setting up a user ID with a restricted shell, and then allowing SSH access by that user ID. I can't tell from your question.

  • 1
    An example of the use of the FTP QUOTE command to do non-FTP things is in the ADAM2 bootloader, which is the bootloader used in some DSL routers. wiki.openwrt.org/doc/howto/generic.flashing.ftp
    – LawrenceC
    Jul 13, 2012 at 1:58
  • Interesting: The "r" in rsh is for remote (but probably it is the same thing: it is restricted because it is remote). On my Debian, when you invoke it, you get ssh! (And man rsh also gets you the ssh manpage, which says ssh replaces rsh and some other tools.) On my school's Solaris system, it is still there. Jul 13, 2012 at 7:44
  • 3
    @Emanuel Berg: two "rsh" exist, one is "Remote Shell" the other is "Restricted" shell. Nobody in these modern times should use remote shell. Everything passes over the network in cleartext.
    – user732
    Jul 13, 2012 at 13:36
  • 1
    @BruceEdiger There exists a Kerberized version of rsh, which is encrypted over the network. But ssh tends to be more common.
    – ephemient
    Jul 13, 2012 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .