To build the user's password entries we can use a user creation script
(just one like adduser) or to add the entries by hand. I usually prefer
the second way, but first is also fine. If you choose the first method,
when the creation scripts ends its work, you have to edit the files
by hand. Here, I will use the second. Our nick name for the test user
used in the examples will be user3.
All the magic resides on the /etc/passwd file. We have to add
a line in this file to create a user in this machine. You have to setup
also /etc/group and /etc/shadow if you have shadow
passwords installed. Note also that you have to fit the uid an gid fields
password, etc.
user3:x:101:101:Jail Test User:/var/chroot:/usr/local/bin/jail
Note the
/var/chroot field. This is the
root
directory of the chroot environment for this user.