Answer the question
In order to leave comments, you need to log in
How to create a user in Debian with SSH access to only one folder?
Hello!
How to create a user on Debian OS with access to a folder like /var/www/vhosts/domain.ru/httpdocs/folder. And there he could enter commands through Putty like rm -r, unzip, etc. I tried to make access through useradd -m -d /var/www/vhosts/domain.ru/httpdocs/folder test01, but as a result, when authorizing through Putty, the user gets into the root directory of the server.
Answer the question
In order to leave comments, you need to log in
It is better to provide access via SFTP (client can use WinSCP).
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question