Post by TeddyI have a chroot environment where I want to start a statically linked
bash-shell (chroot /mnt /usr/bin/env -i PS1='\u:\w\$ ' /bin/bash). I
have set /mnt/etc/password and /mnt/etc/group files (copied from a
I have no name!:/#
Do I have to create other files for a working bash (that shows me
"root" as user)?
Do you mean /etc/passwd? This might be the problem. You might also
need /etc/shadow, or any other databases listed in /etc/nsswitch.conf
(copy this, too).
When I have set up chroots, I bind mount the files to keep them in
sync. For example:
$ mount | grep chroot/sid
/dev/mapper/hda_vg-sid_chroot on /srv/chroot/sid type ext3 (rw)
/dev/pts on /srv/chroot/sid/dev/pts type none (rw,bind)
tmpfs on /srv/chroot/sid/dev/shm type tmpfs (rw)
proc on /srv/chroot/sid/proc type proc (rw)
/dev/mapper/hda_vg-home on /srv/chroot/sid/home type ext3 (rw,quota,user_xattr)
/tmp on /srv/chroot/sid/tmp type none (rw,bind)
/etc/passwd on /srv/chroot/sid/etc/passwd type none (ro,bind)
/etc/shadow on /srv/chroot/sid/etc/shadow type none (ro,bind)
/etc/group on /srv/chroot/sid/etc/group type none (ro,bind)
/etc/resolv.conf on /srv/chroot/sid/etc/resolv.conf type none (ro,bind)
Depending on the need for security in the chroot, you might want to
remove some of these mounts.
$ dchroot -c sid id
(sid) id
uid=1000(rleigh) gid=1000(rleigh) groups=20(dialout),24(cdrom),25(floppy),29(audio),40(src),44(video),46(plugdev),1000(rleigh),1001(sbuild)
Regards,
Roger
- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.