I'm working on a solution to restrict the user to the home directory or a specific directory.
I need to restrict a user for below scenario,
we have multiple Wordpress installation in webroot /var/www/html/wordpress1
and /var/www/html/wordpress2
, I need to create a user and set a new user home directory as /var/www/html/wordpress2/wp-content
and when this new user connected with a password using WinSCP, the user should be able to access only /var/www/html/wordpress2/wp-content
and user cannot go out of the directory.
I have followed the below steps to create a user and group and set user home directory and changed sshd_config
but when a user connects to the server using Winscp, user still able to access any directory on the server.
useradd -g sftpgroup -d /var/www/html/wordpress2/wp-content sftpuser1
sudo passwd sftpuser1
Modified the /etc/ssh/sshd_config
Subsystem sftp internal-sftp
Match Group sftpgroup
ChrootDirectory /home
ForceCommand internal-sftp
X11Forwarding no
AllowTcpForwarding no
After the configuration, still a new user able to see all the other folders on the server.
Hope this diagram helps to understand my problem enter image description here
Can someone please help me with some solution