Linux From Scratch: Version 5.1-pre1
Prev | Chapter 5. Constructing a temporary system | Next

# Adding the user lfs

When logged in as root, making a single mistake can damage or even wreck your system. Therefore we recommend that you build the packages in this chapter as an unprivileged user. You could of course use your own user name, but to make it easier to set up a clean work environment we'll create a new user lfs and use this one during the installation process. As root, issue the following command to add the new user:

    useradd -s /bin/bash -m -k /dev/null lfs

The meaning of the switches:

- `-s /bin/bash`: This makes `bash` the default shell for user lfs.

- `-m -k /dev/null`: These create a home directory for lfs, while preventing the files from a possible `/etc/skel` being copied into it.

If you want to be able to log in as lfs, then give this new user a password:

    passwd lfs

Now grant this new user lfs full access to `$LFS/tools` by giving it ownership of the directory:

    chown lfs $LFS/tools

If you made a separate working directory as suggested, give user lfs ownership of this directory too:

    chown lfs $LFS/sources

Next, login as user lfs. This can be done via a virtual console, through a display manager, or with the following substitute user command:

    su - lfs

The "-" instructs su to start a login shell.

Prev | Home | Next
Creating the $LFS/tools directory | Up | Setting up the environment