Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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. – Gilles Jul 12 '12 at 22:37

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.

share|improve this answer
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 '12 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. – Emanuel Berg Jul 13 '12 at 7:44
@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. – Bruce Ediger Jul 13 '12 at 13:36
@BruceEdiger There exists a Kerberized version of rsh, which is encrypted over the network. But ssh tends to be more common. – ephemient Jul 13 '12 at 17:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.