[CentOS] Prompt for chrooted users

Tue Jul 7 16:28:34 UTC 2015
Gordon Messmer <gordon.messmer at gmail.com>

> James B. Byrne wrote:
>> So, before I go messing around moving files I would some information
>> from you as tio what I have overlooked.  Do I need to move something
>> like etc/passwd and /etc/group into the chroot/etc?

You haven't said anything about the process you used, so it's hard to 
say what you've overlooked.

The basics thing to remember is that the chroot is expected to be a 
complete system.  If you need name resolution, then /etc/passwd and 
/etc/group need to be present in the chroot.  If you need DNS 
resolution, /etc/resolv.conf, too.  If your system uses sssd, chroot 
won't have access to it.  The shell and all of the commands and all of 
the associated libraries must be in the chroot.  Finally, the user's 
home directory has to exist within and relative to the chroot directory.

So, if the user's home directory is /home/user and you want to chroot 
them there, you would expect to have something like:

/home/user/bin/bash
/home/user/etc/bash_profile
/home/user/home/user/.bash_profile

You could symlink /home/user/home/user to /, as well.