7.2. Changing Ownership

#### Linux From Scratch - Version r13.0-174-systemd

### Chapter 7. Entering Chroot and Building Additional Temporary Tools

- Prev

  Introduction

- Next

  Preparing Virtual Kernel File Systems

- Up
- Home

# 7.2. Changing Ownership

### Note

The commands in the remainder of this book must be performed while logged in as user `root` and no longer as user `lfs`. Also, double check that `$LFS` is set in `root`'s environment.

Currently, the whole directory hierarchy in `$LFS` is owned by the user `lfs`, a user that exists only on the host system. If the directories and files under `$LFS` are kept as they are, they will be owned by a user ID without a corresponding account. This is dangerous because a user account created later could get this same user ID and would own all the files under `$LFS`, thus exposing these files to possible malicious manipulation.

To address this issue, change the ownership of the `$LFS/*` directories to user `root` by running the following command:

    chown --from lfs -R root:root $LFS/{usr,var,etc,tools}
    case $(uname -m) in
      x86_64) chown --from lfs -R root:root $LFS/lib64 ;;
    esac

- Prev

  Introduction

- Next

  Preparing Virtual Kernel File Systems

- Up
- Home