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

How can I ensure that users can't login to the system except with FTP?

share|improve this question

closed as too localized by Chris Down, Mat, Renan, Ulrich Dangel, jasonwryan Aug 19 '12 at 4:45

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

What Linux distribution? What FTP server? – Mikel May 6 '12 at 15:57

Create users with the nologin shell.

Then they will be able to authenticate to the FTP server with their username and password, but they won't be able to ssh or telnet in.

For example on a Fedora or Red Hat system:

# useradd -s /sbin/nologin username
# passwd username
<type the password>
share|improve this answer
Do not use FTP with "real" accounts! FTP sends all traffic ic clear text. – vonbrand Jan 26 '13 at 3:03

There are a couple of approaches to this, depending on your needs.

One is to set the shell to something not a shell, as described in another answer.

Another is to use iptables to set up a firewall that disallows all but FTP access. If you want to make the server publicly accessible at all, I recommend this option, possibly in combination with the first. You will need to enable connection tracking for it to work properly with FTP.

share|improve this answer

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