<< Back to man.ChinaUnix.net

6.4. Changing Ownership

Currently, the /tools directory is owned by the user lfs, a user that exists only on the host system. Although the /tools directory can be deleted once the LFS system has been finished, it can be retained to build additional LFS systems. If the /tools directory is kept as is, the files are 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 the /tools directory and all the files therein, thus exposing these files to possible malicious manipulation.

To avoid this issue, add the lfs user to the new LFS system later when creating the /etc/passwd file, taking care to assign it the same user and group IDs as on the host system. Alternatively, assign the contents of the /tools directory to user root by running the following command:

chown -R 0:0 /tools

The command uses 0:0 instead of root:root, because chown is unable to resolve the name “root” until the password file has been created. This book assumes you ran this chown command.