Restrict FTP users to a directory

The first step is to install an FTP server. You can find how to do it here.

Once the server is installed, you have to configure the users that will connect with FTP.

To add a user with permissions for a specific domain, you have to set the vhost directory as the user’s homedir.

useradd -m -d /var/www/vhosts/ USERNAME

or if you want to disable shell access for the user

useradd -m -d /var/www/vhosts/ -s /sbin/nologin USERNAME

Now the user is created and is able to connect to the server with any FTP client.

IMPORTANT: Shell access will allow the user access to all readable files on your server.