bad ownership or modes for chroot directory component
Specifies the pathname of a directory to chroot(2) to after authentication. All components of the pathname must be root-owned directories that are not writable by any other user or group. After the chroot, sshd(8) changes the working directory to the user's home directory.
My guess is one or more of the directories on the path do not meet those requirements (my suspicion is
www is owned or writable by your web user, not root).
Go back and follow the directions, ensuring that the requirements above in bold italics are met.
ChrootDirectory directory must be owned by root and have 755 mode:
sudo chown root:root /var/www/RESTRICTED_DIR sudo chmod 755 /var/www/RESTRICTED_DIR
Ok, now all files into
/var/www/RESTRICTED_DIR must be owned by
MY_USER, which must belong to
www-data group, and have 775 mode to allow group permissions, like this:
sudo usermod -a -G www-data MY_USER sudo chown MY_USER:www-data /var/www/RESTRICTED_DIR/* sudo chmod 775 -R /var/www/RESTRICTED_DIR/*
NOTE: Remember is a good practice allow access only to an htdocs folder if you are configuring apache.
After some troubleshooting today, I realized that root must also be able to write to the directories.
The following did not work:
$ ls -ld /mnt/synology03/files/ dr-xr-xr-x 1 root root 156 Oct 8 20:10 /mnt/synology03/files/ $ ls -ld /mnt/synology03 drwxr-xr-x 7 root root 4096 Oct 1 21:26 /mnt/synology03 $ ls -ld /mnt drwxr-xr-x 6 root root 4096 Feb 8 10:01 /mnt $ ls -ld / drwxr-xr-x 24 root root 4096 Jan 14 09:22 /
As soon as I fixed this, my chroot started working.
$ sudo chmod 755 /mnt/synology03/files/ $ ls -ld /mnt/synology03/files/ drwxr-xr-x 1 root root 156 Oct 8 20:10 /mnt/synology03/files/