Adding the LFS User

Ch. 4.3 of the manual.

Add LFS user and group

sudo groupadd lfs
sudo useradd -s /bin/bash -g lfs -m -k /dev/null lfs

This adds user lfs, -m creates a home directory for user lfs
-k /dev/null prevents something
-s /bin/bash makes bash its default shell.

Add user lfs password

sudo passwd lfs

It responds “bad password” and wants 8 characters, but it takes it. (Bad, bad password!)

See all users and groups:

cat /etc/passwd
cat /etc/group

I see my uid/gid is 1000 and lfs’s in 1001

Make user lfs the owner of all directories of $LFS

except I guess $LFS/sources.

sudo chown -v lfs $LFS/{usr{,/*},var,etc,tools}

verbose output:
Changed ownership of ‘/mnt/lfs/usr’ from root to lfs
Changed ownership of ‘/mnt/lfs/usr/bin’ from root to lfs
Changed ownership of ‘/mnt/lfs/usr/lib’ from root to lfs
Changed ownership of ‘/mnt/lfs/usr/sbin’ from root to lfs
Changed ownership of ‘/mnt/lfs/var’ from root to lfs
Changed ownership of ‘/mnt/lfs/etc’ from root to lfs
Changed ownership of ‘/mnt/lfs/tools’ from root to lfs

Oh oh a mystery “case” again in the manual:

case ${uname -m} in x86_64 chown -v lfs $LFS/lib 64 ;; esac

I’m substituting

uname -m

Checking one more time in case miniPC transformed while I wasn’t looking

sudo chown -v lfs $LFS/lib64

verbose output
Changed ownership of ‘/mnt/lfs/lib64’ from root to lfs

Start a login shell running as user lfs

su -lfs
  • login shell for lfs
  • loads lfs’s environment
  • working directory will be lfs home directory

If the prompt “lfs:~$” does not appear immediately, enter the fg command.

It does appear immediately:

lfs@heidi-GK41:~$

How do I switch back to me as user?

exit
logout

Google AI Mode says that I should have removed access to the /etc/bash.bashrc file before logging in for the first time. Unfortunately that was covered in Ch. 4.4 whereas logging in was instructed in Ch. 4.3. We’ll just have to see what happens.