How Do I Create a Debian User with SSH Access to Only One Folder?

Option 1 

Provide the user with SFTP access. This option is simpler. Recommended in cases where the user only needs to work with files.

sudo useradd -m -d /var/www/vhosts/domain.ru/httpdocs/folder -s /bin/false -c "SFTP ACCESS"  -g www-data  user-name

sudo usermod -a -G www-data user-name

sudo passwd user-name



add to /etc/ssh/sshd_config

Match User user-name

ChrootDirectory %h

ForceCommand internal-sftp

AllowTcpForwarding no

X11Forwarding no

Option 2

Restrict SSH access of the user to a specific directory using the chroot mechanism. In this case, the user will be able to execute all commands in the specified directory. Read more in this article.