Hello, I tried your tutorial but it doesn't work on my side. I have wordpress folder at this location:
/var/www/html/wordpress
Therefore, my root folder for my websites should be /var/www/html.
Here is the I run in order to do all the steps:
userdel sftp;
useradd sftp --home-dir /var/www/html \
--gid www-data \
--shell /usr/sbin/nologin \
--password 'test'
for dir in /var /var/www /var/www/html ; do
chown root:root $dir
chmod 0755 $dir
done
chown -R www-data:www-data /var/www/html/wordpress;
find /var/www/html/wordpress -type d -exec chmod 2775 {} \;
find /var/www/html/wordpress -type f -exec chmod 0664 {} \;
rm /etc/ssh/sshd_config.d/sftp.conf
cat >> /etc/ssh/sshd_config.d/sftp.conf <<EOF
# SSH config for SFTP only user
Match User sftp
ForceCommand internal-sftp -u 002
ChrootDirectory /var/www/html
PasswordAuthentication yes
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
PermitTunnel no
EOF
And after:
systemctl restart ssh;
sftp sftp@localhost
When I try with password = test,
I have permission denied error. I have uncommented line "Subsystem sftp internal-sftp" in /etc/ssh/sshd_config.
Do you know why I got this error? Thank you in advance,
Arno.
Not working on my side