I was playing with chroot, and I was able to reproduce an issue where it wasn't working for anything but user ID 0.
Since this was 2009, it was probably on Unity Linux or PCLinuxOS.
su - adduser -o -u 0 chroot1 adduser chroot2 mkdir /home/chroot1/tmp-mount mkdir /home/chroot2/tmp-mount mount -o bind / /home/chroot1/tmp-mount mount -o bind / /home/chroot2/tmp-mount
Steps to reproduce ∞
First one with UID 0
su - chroot1 -c 'chroot ./tmp-mount/'
Second one with UID non-0
su - chroot2 -c 'chroot ./tmp-mount/'
-bash: chroot: command not found
ok, try with this:
su - chroot2 -c '/usr/sbin/chroot ./tmp-mount/'
/usr/sbin/chroot: cannot change root directory to ./tmp-mount/: Operation not permitted
su - umount /home/chroot1/tmp-mount umount /home/chroot2/tmp-mount userdel -r chroot1 userdel -r chroot2
- So how do I do what I want, when the user has UID non-0?
How do I change a user's UID temporarily?