1

I'm testing some software under Debian X32. Its a chroot environment, and its entered upon as root. Some of the tests are failing because of the root account:

make test
...
# Failed test 'Testing that we aren't running as a privileged user, such as root'
# at ../test/recipes/40-test_rehash.t line 49.
...
# Looks like you failed 1 test of 5.
../test/recipes/40-test_rehash.t ........... Dubious, test returned 1
(wstat 256, 0x100)
Failed 1/5 subtests    
...

Trying to drop privileges by su'ing fails:

# su - jdoe
No passwd entry for user 'jdoe'

How do I drop privileges in a Debian Chroot?

2
  • 2
    The problem is probably that the user does not exist in the new root. You should be able to create it.
    – AFH
    Jun 23, 2016 at 12:14
  • @AFH - That worked. Please provide an answer so I can accept. Any reason the Chroot does not use (or get access to) the user database?
    – jww
    Jun 23, 2016 at 18:52

1 Answer 1

1

I assume that the reason for the error is that the user exists in the old file system, but not the new one that you have changed to with chroot.

If I knew exactly where all the user details are held, I could advise on which files and directories from the old file system should be copied / linked / mounted into the new, in order that the old users can log into the operating system running with the new root. I think most of them will be in /etc, but you can't just replace that directory regardless, as it will contain configuration data specific to the new file system.

Failing that, a simple solution is to create the users you want within the new file system. Since your purpose is to test non-privileged users, you do not need to reproduce existing users exactly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .