I've recompiled busybox and installed it to /home/www/bin/httpd.
I can run it as per normal:
tc@box:/$ sudo /home/www/bin/httpd
tc@box:/$ ps | grep httpd
9306 root /home/www/bin/httpd
9308 tc grep httpd
tc@box:/$
and I can chroot it running under root as well:
tc@box:/$ sudo chroot /home/www /bin/httpd
tc@box:/$ ps | grep httpd
9331 root /bin/httpd
9333 tc grep httpd
tc@box:/$ sudo ls -l /proc/9331/root
lrwxrwxrwx 1 root root 0 Feb 19 21:00 /proc/9331/root -> /home/www
tc@box:/$
However, if I try and run it under the 'www' user I've created, I get:
tc@box:/$ sudo chroot /home/www /bin/httpd -u www:www
httpd: unknown user/group www:www
tc@box:/$
But, AFAIK, I have that user ('www') and group ('www') set up in the chroot environment:
tc@box:/$ ls -l /home/www
total 0
drwxr-xr-x 2 www www 100 Feb 19 07:24 bin/
drwxr-xr-x 2 www www 60 Feb 19 18:46 dev/
drwxr-xr-x 2 www www 200 Feb 19 19:24 etc/
drwxr-xr-x 2 www www 80 Feb 19 07:19 lib/
drwxr-xr-x 3 www www 60 Feb 19 07:20 usr/
tc@box:/$ ls -l /home/www/etc
total 32
-rwxr-xr-x 1 www www 13 Feb 19 19:20 group
-rwxr-xr-x 1 www www 11 Feb 19 19:24 gshadow
-rwxr-xr-x 1 www www 4 Jan 1 1970 hostname
-rwxr-xr-x 1 www www 290 Jan 1 1970 hosts
-rwxr-xr-x 1 www www 189 Jan 14 08:17 nsswitch.conf
-rwxr-xr-x 1 www www 49 Feb 19 07:16 passwd
-rwxr-xr-x 1 www www 42 Jan 1 1970 resolv.conf
-rwxr-xr-x 1 www www 58 Feb 19 07:16 shadow
tc@box:/$ sudo cat /home/www/etc/group
www:x:80:www
tc@box:/$ sudo cat /home/www/etc/gshadow
www:!::www
tc@box:/$ sudo cat /home/www/etc/shadow
www:$1$CPekkMr0$/kT4YhWGFuQIjK6CcXorg0:16485:0:99999:7:::
tc@box:/$ sudo cat /home/www/etc/passwd
www:x:1000:80:Linux User,,,:/home/www:/bin/false
tc@box:/$
I don't know where I've gone wrong. Can anyone help?