Bug 628 - (chroot) can't solve error message: sudo: unknown uid 1000: who are you?
(chroot) can't solve error message: sudo: unknown uid 1000: who are you?
Status: RESOLVED INVALID
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.7
PC FreeBSD
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-14 10:03 MST by dreamcat4
Modified: 2013-12-14 11:37 MST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dreamcat4 2013-12-14 10:03:56 MST
Hi there,

Problem Description:
=====================

* Sudo v1.8.8. FreeBSD 9.1-RELEASE operating system.

* Full FreeBSD base image inside a chroot folder.

* Copied over these files:
    $ cp -f "/etc/passwd" "/chroot/etc/passwd"
    $ cp -f "/etc/master.passwd" "/chroot/etc/master.passwd"
    $ cp -f "/etc/pwd.db" "/chroot/etc/pwd.db"
    $ cp -f "/etc/group" "/chroot/etc/group"

* Chrooting, drop down to be a regular user
    $ chroot -u user -g wheel /chroot

* "id" command recognises the user name inside the chroot.
    $ id -a
    uid=1000(user) gid=1000(admin) egid=0(wheel) groups=0(wheel),50(ftp)

* However "sudo <cmd>" does not know my username, and errors out
    $ sudo ls
    sudo: unknown uid 1000: who are you?

* Even errors out for the informational subcommands
    $ sudo --list
    sudo: unknown uid 1000: who are you?
    $ sudo --version
    sudo: unknown uid 1000: who are you?


Not sure at this point what else could be missing inside the chroot. Sudo seems to need something else to be present. Could not find answers from the man page. No luck with google either.

* I can see "sudo.c" on the net. There are only a very few places where this check can be erroring-out. (although that is not the latest version of sudo).
    http://www.opensource.apple.com/source/sudo/sudo-46/src/sudo.c

* I can recompile sudo with arbitrary modifications. For example to do extra debugging. With the src in the build folder of my FreeBSD ports tree.

Any help welcome / appreciated.
Comment 1 Todd C. Miller 2013-12-14 11:28:09 MST
You are missing /chroot/etc/spwd.db".  You do not really need /chroot/etc/master.passwd" as nothing should read that directly.
Comment 2 dreamcat4 2013-12-14 11:37:13 MST
A-ha!
"/etc/spwd.db" was missing from that list. Didn't know about that one.

sudo calls getpwuid(); in a single place to display that error message. "man getpwuid" FILES showed the omitted password db file.

I added the missing file along with the 4 previous already. Problem went away. All resolved. Sorry for bothering you guys about this.