This question already has an answer here:

I've read a lot of pages about jailing users and now I'm confused. I want to jail my users to their dirs on sftp and ssh access, so they could see only files in /home/. What solution I should use to do it in the best (and easiest as possible) way?

I'm new in linux and I still can't get it xD

marked as duplicate by muru, Zanna, TheWanderer, David Foerster, Eric Carvalho Feb 5 '17 at 14:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • How do you imagine jailed shell access to work? The user won't be able to run any programs unless all required binaries and executables are available in the chroot jail. – David Foerster Feb 5 '17 at 13:50

Chrooting sftp/scp users is relatively easy, but properly chrooting ssh users will be more difficult.

For sftp/scp, this weblink should suffice. Make sure to read all the comments, not just the highest rated ones.

For chrooting ssh users, you can have a look at Jailkit. Very good, but it will require quite a lot of work and maintenance. The advantage is that Jailkit could offer both sftp and ssh for users.

Apart from this, Lshell could be interesting to add severe restrictions for ssh users, but last time I tried it, it would not limit navigation for sftp users.

Not the answer you're looking for? Browse other questions tagged or ask your own question.