Configuring chroot for sftp and rsync via rssh

I'm setting up gulp-rsync via rssh in ubuntu I want the user to have the ability to sftp and rsync without access to ssh and other protocols.

Question how to make it so that users can not view other directories

In general, let's say I create a user

useradd -m -d /var/www/DOMAIN.RU/ -s /usr/bin/rssh USERNAME
passwd USERNAME

Next, if you immediately connect via SFTP, the user is in the desired directory, but he can get out of it, let's say so

cd /

Then I edit the file /etc/rssh. conf to set up a chroot for the user and then the fun begins

allowsftp
allowrsync

umask = 022

chrootpath = /var/www/DOMAIN.RU
user=USERNAME:011:000110:"/var/www/DOMAIN.RU"  # both with chroot

After that, I save the file, restart apache and the user can not connect via SFTP writes

Conecction closed
Author: Михаил Волков, 2020-07-01