I want to have a user to be able to login with ssh, but only be able to read files from a specific directory.
I did some research. Is it true that this is only possible with chroot and home directories?
Running Debian 10.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Done this recently with restricted bash (rbash). https://www.gnu.org/software/bash/manual/html_node/The-Restricted-Shell.html
One of it's restrictions:
Changing directories with the cd builtin.
Set user's default shell to
/bin/rbash and directory to the directory that you wan't to limit him to in
/etc/passwd and he will not be able to
cd out of it.
Alternatively you could add an alias in the user's shell profile file:
alias cd='printf ""'