| 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
 | 
|---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
 | 
|---|
| 3 |   "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
 | 
|---|
| 4 |   <!ENTITY % general-entities SYSTEM "../../general.ent">
 | 
|---|
| 5 |   %general-entities;
 | 
|---|
| 6 | ]>
 | 
|---|
| 7 | 
 | 
|---|
| 8 | <sect1 id="ch-chroot-changingowner">
 | 
|---|
| 9 |   <?dbhtml filename="changingowner.html"?>
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   <title>Changing Ownership</title>
 | 
|---|
| 12 | 
 | 
|---|
| 13 |     <para os="a">Currently, the <filename class="directory">/tools</filename>
 | 
|---|
| 14 |     and <filename class="directory">/cross-tools</filename> directories
 | 
|---|
| 15 |     are owned by the user <emphasis>lfs</emphasis>, a user that
 | 
|---|
| 16 |     exists only on the host system. Although the <filename
 | 
|---|
| 17 |     class="directory">/tools</filename> and <filename
 | 
|---|
| 18 |     class="directory">/cross-tools</filename> directories can be deleted
 | 
|---|
| 19 |     once the LFS system has been finished, they can be retained to build
 | 
|---|
| 20 |     additional LFS systems. If the <filename class="directory">/tools</filename>
 | 
|---|
| 21 |     and <filename class="directory">/cross-tools</filename> directories are
 | 
|---|
| 22 |     kept as is, the files are owned by a user ID without a corresponding
 | 
|---|
| 23 |     account. This is dangerous because a user account created later could
 | 
|---|
| 24 |     get this same user ID and would own the <filename
 | 
|---|
| 25 |     class="directory">/tools</filename> directory and all the files therein,
 | 
|---|
| 26 |     thus exposing these files to possible malicious manipulation.</para>
 | 
|---|
| 27 | 
 | 
|---|
| 28 |     <para os="b">To avoid this issue, add the <systemitem
 | 
|---|
| 29 |     class="username">lfs</systemitem> user to the new LFS system later when
 | 
|---|
| 30 |     creating the <filename>/etc/passwd</filename> file, taking care to assign
 | 
|---|
| 31 |     it the same user and group IDs as on the host system. Alternatively,
 | 
|---|
| 32 |     assign the contents of the <filename class="directory">/tools</filename>
 | 
|---|
| 33 |     and <filename class="directory">/cross-tools</filename> directories to
 | 
|---|
| 34 |     user <systemitem class="username">root</systemitem> by running the
 | 
|---|
| 35 |     following commands:</para>
 | 
|---|
| 36 | 
 | 
|---|
| 37 | <screen os="c"><userinput>chown -Rv 0:0 /tools
 | 
|---|
| 38 | chown -Rv 0:0 /cross-tools</userinput></screen>
 | 
|---|
| 39 | 
 | 
|---|
| 40 |     <para os="d">The commands use <parameter>0:0</parameter> instead of
 | 
|---|
| 41 |     <parameter>root:root</parameter>, because <command>chown</command>
 | 
|---|
| 42 |     is unable to resolve the name <quote>root</quote> until the
 | 
|---|
| 43 |     <filename>passwd</filename> file has been created.</para>
 | 
|---|
| 44 | 
 | 
|---|
| 45 | </sect1>
 | 
|---|