Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: PingPing on February 19, 2015, 01:03:46 PM

Title: chroot httpd error: unknown user/group www:www
Post by: PingPing on February 19, 2015, 01:03:46 PM
I've recompiled busybox and installed it to /home/www/bin/httpd.
I can run it as per normal:

Code: [Select]
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:

Code: [Select]
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:

Code: [Select]
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:

Code: [Select]
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?
Title: Re: chroot httpd error: unknown user/group www:www
Post by: curaga on February 20, 2015, 01:11:41 AM
To debug it, add strace to the chroot, chroot to a shell, and run httpd under strace.
Title: Re: chroot httpd error: unknown user/group www:www
Post by: PingPing on February 20, 2015, 11:02:38 PM
strace is not in the piCore repo (http://www.tinycorelinux.net/6.x/armv6/tcz/)  :(
Title: Re: chroot httpd error: unknown user/group www:www
Post by: bmarkus on February 21, 2015, 12:58:35 AM
strace is not in the piCore repo (http://www.tinycorelinux.net/6.x/armv6/tcz/)  :(

Added to repo.