How to allow users to connect only to the ftp

Sometimes you need to give ftp access to a user, but forbid him to login the system.

The easiest way to do that is to make /usr/sbin/nologin the user’s default shell, on Debian based systems, and /sbin/nologin on Fedora distros.

Debian:$ sudo chsh -s /usr/sbin/nologin mike
Fedora:$ sudo chsh -s /sbin/nologin mike

With */nologin the user is allowed to use sudo or login to ftp but will have the ssh, scp or su disabled.

If you use /sbin/false, all the access to the system will be disabled:

$ sudo chsh -s /bin/false mike

To create a user with a no login shell, use:

Linux: $ sudo useradd -s /bin/false mike

Debian: $ sudo useradd -s /usr/sbin/nologin mike
Fedora: $ sudo useradd -s /sbin/nologin mike

Tagged with: , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!