WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: chroot httpd error: unknown user/group www:www  (Read 2757 times)

Offline PingPing

  • Jr. Member
  • **
  • Posts: 99
chroot httpd error: unknown user/group www:www
« on: February 19, 2015, 04: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?

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11041
Re: chroot httpd error: unknown user/group www:www
« Reply #1 on: February 20, 2015, 04:11:41 AM »
To debug it, add strace to the chroot, chroot to a shell, and run httpd under strace.
The only barriers that can stop you are the ones you create yourself.

Offline PingPing

  • Jr. Member
  • **
  • Posts: 99
Re: chroot httpd error: unknown user/group www:www
« Reply #2 on: February 21, 2015, 02:02:38 AM »
strace is not in the piCore repo (http://www.tinycorelinux.net/6.x/armv6/tcz/:(

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: chroot httpd error: unknown user/group www:www
« Reply #3 on: February 21, 2015, 03:58:35 AM »
« Last Edit: February 21, 2015, 04:57:23 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."