[H-GEN] chroot + su

davidj at meesha.humbug.org.au davidj at meesha.humbug.org.au
Wed Jan 6 21:08:58 EST 1999


I'm trying to chroot an eggdrop (don't ask, it's because we can :).

I've setup eggdrop in /home/eggdrop. It has a user, eggdrop, in group eggdrop.

A listing of /home/eggdrop/bin is:
-r-xr-xr-x   1 root     root      1173883 Jan  7 11:15 bash
-r-xr-xr-x   1 root     root         9032 Jan  7 11:36 cat
-r-xr-xr-x   1 root     root         8044 Jan  7 11:41 hostname
-r-xr-xr-x   1 root     root         8632 Jan  7 11:41 id
-r-sr-xr-x   1 root     root        12648 Jan  7 11:20 su
-r-xr-xr-x   1 root     root         4412 Jan  7 12:02 whoami

A listing of /home/eggdrop/lib is:
-r-xr-xr-x   1 root     root       159488 Jan  4 10:15 ld-linux.so.2
-r-xr-xr-x   1 root     root      3063916 Jan  7 11:12 libc.so.6
-r-xr-xr-x   1 root     root       181993 Jan  7 11:22 libcrypt.so.1
-r-xr-xr-x   1 root     root        37146 Jan  4 10:15 libdl.so.2
-r-xr-xr-x   1 root     root       413550 Jan  4 10:15 libm.so.6
-r-xr-xr-x   1 root     root        81462 Jan  4 10:15 libnsl.so.1
-r-xr-xr-x   1 root     root        95602 Jan  7 11:22 libpam.so.0
-r-xr-xr-x   1 root     root        25358 Jan  7 11:22 libpam_misc.so.0
-r-xr-xr-x   1 root     root        12252 Jan  7 11:15 libtermcap.so.2
dr-xr-xr-x   2 root     root         1024 Jan  7 11:44 security

/home/eggdrop/lib/security are the pam modules, to be pruned later.

I have /home/eggdrop/etc:
-rwxr-xr-x   1 root     root         8044 Jan  7 11:41 bin
-r--r--r--   1 root     root           28 Jan  7 11:35 group
-r--r--r--   1 root     root           57 Jan  7 11:47 passwd
-r--r--r--   1 root     root          371 Jan  7 11:42 profile

Obviously, I can't su - eggdrop then chroot, so I have to chroot then su

[root at munchybum eggdrop]# !chroot
chroot /home/eggdrop/ /bin/bash
[I have no name!@munchybum /]# whoami
whoami: cannot find username for UID 0
[I have no name!@munchybum /]# id
uid=0 gid=0 groups=0,1,2,3,4,6,10

Can someone put some light on the fact that bash and whoami knows 
nothing of it's username? What's more confusing, is that id seems to be 
ignoring the chroot, as root is indeed present in the above mentioned 
group, in the true /etc/groups. The /home/eggdrop/etc/group has only

[root at munchybum eggdrop]# cat etc/group
root::0:root
eggdrop:x:503:

in it.

Any help?

-- 
David "Yes, of course I'll use chattr" Jericho




More information about the General mailing list