OpenSSH≥4.8 supports a ChrootDirectory
directive.
Add to /etc/sshd_config
or /etc/ssh/sshd_config
or whatever your setup’s global sshd
config file is:
Match user ben_files # The following two directives force ben_files to become chrooted # and only have sftp available. No other chroot setup is required. ChrootDirectory /var/www/vhosts/mydomain.example/files ForceCommand internal-sftp # For additional paranoia, disallow all types of port forwardings. AllowTcpForwarding no GatewayPorts no X11Forwarding no