How can I disable the users to go out from the home folder. For example, I have a NTFS partition mounted under
/media/ntfs, so if the user logs in through ssh he can reach this partition. How can I disable the users to
cd out from their home directory?
Reassess your requirement first. What is the problem you are trying to solve? Why do you want to prevent users from leaving their home directory? Isn't it rather that you don't want them to nose around in specific other directories -- such as the home directories of other users?
It is very difficult to prevent users from leaving their home directory. It is actually a bit silly, too (explanation follows). It is much simpler to prevent users from entering directories you don't want them to enter.
First off, yes you can give users a so-called restricted shell, see
The next step up is a root jail. More info on the community wiki and in this question. Though a root jail will lock a user inside a walled garden, within which she has access to nothing but the files and commands that you put there, root jails really are intended for isolating untrusted software rather than users. In particular, they are for software that needs to run with elevated priviliges -- hence a root jail.
A user, on the other hand, is trusted: he has had to authenticate and runs without elevated priviliges. Therefore file permissions suffice to keep him from changing files he does not own, and from reading things he must not see. World-readability is the default though, for good reason: users actually need most of the the stuff that's on the filesystem. To keep users out of a directory, explicitly make it inaccessible:
PS: Why locking users in their home directory is a bit silly:
Users need access to commands and applications. These are in directories like