V
V
voffkared2014-10-08 13:21:02
SFTP
voffkared, 2014-10-08 13:21:02

How to configure SFTP to /var/www/mydomain.ru site?

Given:
VDS with 5 sites.
Task:
give rwX access via SFTP for the user myuser to /var/www/mydomain.ru and prevent it from getting out of this folder.
It was done:
1. a user was created

useradd myuser -g www-data -d /var/www/mydomain.ru -s /bin/false

2. directory created
mkdir /var/www/mydomain.ru
3. folder permissions
chown root:root /var/www
chmod 770 /var/www

4. subfolder rights
chown mouser:www-data /var/www/mydomain.ru
chmod 775 /var/www/mydomain.ru

5. modified in ssh server config:
nano /etc/ssh/sshd_config
Subsystem sftp internal-sftp
Match Group sftp    
    ChrootDirectory %h
    ForceCommand internal-sftp
    AllowTcpForwarding no

6. web server raised mydomain.ru and directory /var/www/mydomain.ru through webmin
7. restarted the corresponding services
service ssh restart && service apache2 graceful
When a user tries to connect via SFTP through Filezilla, it gives an error about the connection being impossible.
In order to check that everything was done correctly, SFTP was configured by the method described above on the / home / username folder, everything worked like clockwork - both writing and reading.
Who met with this and how can it be overcome?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Petrikov, 2014-10-08
@voffkared

Do not worry, the same proftpd supports working in sftp mode, you can lock the hamster inside with one line in the config. Here is an example setup https://www.digitalocean.com/community/tutorials/h...

V
Valentine, 2014-10-08
@vvpoloskin

Everything is set up, except for the ftp server itself)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question