Wow,
THIS had the answer. I messed with
pam_chroot, but it would work only with a console login, not ssh. Gave up on that approach. The instructions at said site work very well.
Script to make a new user
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Usage: make_jail_user (user to create)"
exit 1
fi
adduser $1
if [ $? -ne 0 ]
then
echo "Error making user!"
exit 1
fi
USER_ID=`grep "^$1:" /etc/passwd | awk -F: '{print $3}'`
if [ $? -ne 0 ]
then
echo "can't find user in /etc/passwd"
exit 1
fi
echo "New UID for $1 is : $USER_ID"
sed "s/\(^$1.*\/home\/\)\($1\):/\1chrootusers\/.\/home\/\2:/" /etc/passwd > 1
sed "s/\($1:[^:]*:[^:]*:\)[^:]*:/\1100:/" 1 > 2
sed "s/\/bin\/bash$/\/usr\/sbin\/jk_chrootsh/" 2 > 3
cp 3 /etc/passwd
echo "$1:x:$USER_ID:100::/home/$1:/bin/bash" >> /home/chrootusers/etc/passwd
mkdir "/home/chrootusers/home/$1"
chown $1 "/home/chrootusers/home/$1"
chgrp users "/home/chrootusers/home/$1"
rm 1 2 3
--
MattWalsh - 01 Jul 2005