C
C
codeZlo2020-08-03 16:14:24
SSH
codeZlo, 2020-08-03 16:14:24

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

2 answer(s)
A
Andrey Barbolin, 2020-08-03
@dronmaxman

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

S
Sanes, 2020-08-03
@Sanes

https://www.tecmint.com/restrict-ssh-user-to-direct...
https://www.techrepublic.com/article/how-to-use-re...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question