I am trying to lock users into their home directory using a dedicated group in the sshd_config. The section of my group looks as follows
Match Group sftponly
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
Using %h or even /home/%u wont work when I try to connect with any user. I checked all permissions on their home directories and everything looks ok.
Interestingly, when I provide ChrootDirectory with a static path, everything works fine.
E.g the following config lets users connect (but in the wrong directory)
Match Group sftponly
ChrootDirectory /home/
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
man sshd_config says that I am using the %h token correctly:
ChrootDirectory accepts the tokens %%, %h, %U, and %u.
Appreciate any hint since I spent hour on it already