How to allow users to connect only to the ftp

How to allow users to connect only to the ftp

In this tutorial I will show you, 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 mathan
Fedora:$ sudo chsh -s /sbin/nologin mathan

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 mathan

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

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

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

Was this Tutorial helpful? Help others share on Facebook, Twitter, and Google Plus!

 
Enjoyed this video?
How to allow users to connect only to the ftp
"No Thanks. Please Close This Box!"