I'm setting up a chroot environment on a shared web server to allow users to modify their web roots within a secure chroot, but am having a problem. Right now when I log in with test accounts I get this...
Last login: Thu Jul 14 09:04:14 2011 from .... id: cannot find name for group ID 507 id: cannot find name for user ID 506 [I have no name!@webserver ~]$
I've verified that the UID / GIDs are correct in the chroot's /etc/passwd. Is there possibly something I may have not put in the chroot that is needed for id->name mapping?
Here's how I setup the chroot...I'll provide a full write up once I get this last issue fixed...
cd /home/ mkdir chroot cd chroot/ groupadd chrootusers useradd treydock usermod -a -G chrootusers treydock
mkdir -p ./{dev,etc,lib,lib64,usr,bin,home} mkdir -p ./usr/{bin,libexec} mkdir -p usr/libexec/openssh mknod -m 666 dev/null c 1 3
cp -R /etc/skel home/treydock chown -R treydock:treydock /home/chroot/home/treydock
cp /etc/ld.so.cache /home/chroot/etc/ cp /etc/ld.so.conf /home/chroot/etc/ cp -R /etc/ld.so.conf.d /home/chroot/etc/ cp /etc/nsswitch.conf /home/chroot/etc/ cp /etc/hosts /home/chroot/etc/ cp /etc/passwd /home/chroot/etc/ cp /etc/group /home/chroot/etc/ cp /etc/resolv.conf /home/chroot/etc/ cp /etc/bashrc /home/chroot/etc/
cp /bin/vi /home/chroot/bin/ cp /bin/ls /home/chroot/bin/ cp /bin/cat /bin/cp /bin/grep /bin/mkdir /bin/mv /bin/rm /bin/rmdir /bin/bash /home/chroot/bin/
cp /usr/bin/scp /home/chroot/usr/bin/ cp /usr/bin/sftp /home/chroot/usr/bin/ cp /usr/bin/ssh /home/chroot/usr/bin/ cp /usr/bin/vim /home/chroot/usr/bin/ cp /usr/bin/id /home/chroot/usr/bin/
cp /usr/libexec/openssh/sftp-server /home/chroot/usr/libexec/openssh/
cd /usr/local/sbin/ wget -O l2chroot http://www.cyberciti.biz/files/lighttpd/l2chroot.txt chmod +x l2chroot vim l2chroot
for i in `ls /home/chroot/bin/`; do l2chroot /bin/$i; done for i in `ls /home/chroot/usr/bin/`; do l2chroot /usr/bin/$i; done l2chroot /usr/libexec/openssh/sftp-server
vim /etc/ssh/sshd_config /etc/init.d/sshd restart
Here is an example of what is in both my system and chroot /etc/passwd
treydock:x:506:507:Trey Dockendorf:/home/treydock:/bin/bash
Thanks - Trey