Tim Tassonis wrote:
Hi all

I currently building LFS (svn) and seem to get a problem doing su in the chroot environment. I am past shadow now and have set-up a user to work with. The user however should be able to su to root. I have done the same on lfs 7.9 and lfs 8.0 without problems.

I think, I follow the book when entering the chroot:

LFS=/lfs export LFS
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run

if [ -h $LFS/dev/shm ]; then
   mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi
chroot "$LFS" /tools/bin/env -i \
     HOME=/root                  \
     TERM="$TERM"                \
     PS1='\u:\w\$ '              \
     PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
    /tools/bin/bash --login +h


In chroot, /dev/pts looks like this:

root@lfsd82:/# ls -ld /dev/pts
drwxr-xr-x 2 root root 0 Feb 11 19:38 /dev/pts
root@lfsd82:/# ls -ld /dev/pts/*
c--------- 1 root root 5, 2 Feb 11 19:38 /dev/pts/ptmx


I can then call "login", enter the user's userid and password and get a shell. I can also do a "su - timtas", which also works.

If I then call "su -" under the user, I always get:

su: must be run from a terminal


The contents of /dev/pts in the chroot always stay:


timtas@lfsd82:~$ ls -l /dev/pts/
total 0
c--------- 1 root root 5, 2 Feb 11 19:38 ptmx


What am I missing?

Well I'm attaching what I use. Of course you have to make sure the non-root user is created in chroot and has a home directory.

Run mount-virt.sh, then enter chroot. You should be able to su from there after a 'useradd -m userid'.

  -- Bruce

Attachment: mount-virt.sh
Description: application/shellscript

Attachment: umount-virt.sh
Description: application/shellscript

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to