I would like to be able to use the sudo command in a chroot environment.
I start the chroot as follows:
chroot /debian-squeeze /bin/bash
Now I'm logged in as root in the chroot. I can do su user to log in as a user named user. Now, sudo does not work:
user@HD:/$ sudo ls
sudo: must be setuid root
Some diagnostics:
user@HD:/$ which sudo
/usr/bin/sudo
user@HD:/$ ls -al /usr/bin/sudo
-rwsr-xr-x 2 root root 143884 May 23 2012 /usr/bin/sudo
user@HD:/$ ls -aln /usr/bin/sudo
-rwsr-xr-x 2 0 0 143884 May 23 2012 /usr/bin/sudo
root@HD:/# cat /etc/sudoers
Defaults env_reset
root ALL=(ALL) ALL
user ALL=(ALL) ALL
%sudo ALL=(ALL) ALL
As root, I can execute sudo without error.
Can anyone explain me why sudo (or setuid) does not work like this?