Quote:
Originally Posted by autotron
How would I go about this, I am a total newbie to this and have just basic skills
|
It depends on what distro this is. Usually, launching a Google search for something along the lines of "how to create a chroot jail Debian" will give you the guides you need (for Debian, at least).
The basic idea is to create a new directory somewhere on the filesystem which will become the new "root" for the user. When they do a "pwd", everything will be referenced to this new root. For example, if you created your chroot in /usr/local/chroot/, and then created a new user with a home directory in /usr/local/chroot/home/user, when they logged into their home directory and ran a "pwd", all they would see is "/home/user", they wouldn't see that their "/home/user" is actually "/usr/local/chroot/home/user" on the real filesystem.
Once you create the chroot for them, you just need to fill it up with the required libraries and executables for them to be able to log in (ssh, bash, etc), and then configure their profile to use it. That will be the hardest part of the process. Once you get the chroot jail working and are able to ssh into it, adding access to /var/www/html is as easy as:
Code:
mount --bind /var/www/html /usr/local/chroot/var/www/html
Replacing /usr/local/chroot with wherever you decided to put it. At that point when the user logs in, the only things he'll be able to see, read, or access, are his home directory, the few executables and libraries you stuck in the chroot to enable logging in, and /var/www/html.