<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="ch-tools-changingowner">
  <?dbhtml filename="changingowner.html"?>

  <title>改变文件所有者</title>

  <note>
    <!--para>The commands in the remainder of this book must be performed while
    logged in as user <systemitem class="username">root</systemitem> and no
    longer as user <systemitem class="username">lfs</systemitem>. Also, double
    check that <envar>$LFS</envar> is set in <systemitem
    class="username">root</systemitem>'s environment.</para-->
	<para>本书中剩余部分的命令都必须用
		<systemitem class="username">root</systemitem> 用户身份执行，
		而不是 <systemitem class="username">lfs</systemitem> 用户。
		另外，记得再次检查 <envar>$LFS</envar> 在
		<systemitem class="username">root</systemitem> 的环境中被正确设定。
	</para>
  </note>

  <!--para>Currently, the <filename class="directory">$LFS/tools</filename> directory
  is owned by the user <systemitem class="username">lfs</systemitem>, a user
  that exists only on the host system. If the <filename
  class="directory">$LFS/tools</filename> 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
  <filename class="directory">$LFS/tools</filename> directory and all the files
  therein, thus exposing these files to possible malicious manipulation.</para-->
  <para>目前，<filename class="directory">$LFS/tools</filename>
	  目录的所有者是 <systemitem class="username">lfs</systemitem>，
	  这是一个仅在宿主系统上存在的用户。如果将它这样保留下去，
	  其中的文件将属于一个没有用户名的用户 ID。这是很危险的，
	  因为未来创建的一个用户名可能得到相同的用户 ID，
	  并获得 <filename class="directory">$LFS/tools</filename>
	  目录及其中文件的所有权，就有可能恶意操作它们。</para>

  <!--para>To avoid this issue, you could add the <systemitem
  class="username">lfs</systemitem> user to the new LFS system later when
  creating the <filename>/etc/passwd</filename> file, taking care to assign it
  the same user and group IDs as on the host system. Better yet, change the
  ownership of the <filename class="directory">$LFS/tools</filename> directory to
  user <systemitem class="username">root</systemitem> by running the following
  command:</para-->
  <para>为了避免这个问题，您可以在后面创建 <filename>/etc/passwd</filename>
	  时将 <systemitem class="username">lfs</systemitem>
	  用户添加到新的 LFS 系统中，注意为它分配和宿主系统一样的用户
	  ID 和组 ID。更好的方式是，现在就把
	  <filename class="directory">$LFS/tools</filename> 目录的所有者改变为
	  <systemitem class="username">root</systemitem>。执行命令：</para>

<screen><userinput>chown -R root:root $LFS/tools</userinput></screen>

  <!--para>Although the <filename class="directory">$LFS/tools</filename> directory
  can be deleted once the LFS system has been finished, it can be retained to build
  additional LFS systems <emphasis>of the same book version</emphasis>. How best
  to backup <filename class="directory">$LFS/tools</filename> is a matter of
  personal preference.</para-->
  <para>尽管 <filename class="directory">$LFS/tools</filename>
	  目录可以在 LFS 系统构建完成后删除，
	  但也可以保留它用于构建更多的<emphasis>相同版本的</emphasis>
	  LFS 系统。用什么方法备份
	  <filename class="directory">$LFS/tools</filename> 取决于个人。
  </para>

  <caution>
    <!--para>If you intend to keep the temporary tools for use in building future LFS
    systems, <emphasis>now</emphasis> is the time to back them up. Subsequent
    commands in chapter 6 will alter the tools currently in place, rendering them
    useless for future builds.</para-->
    <para>如果您有意保留临时工具，用来构建新的 LFS 系统，
		<emphasis>现在</emphasis>就要保存好它们。
		第 6 章中后续执行的命令将就地调整这些工具，
		导致它们不能用于构建新系统。</para>
  </caution>

</sect1>
