⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwdgroup.html

📁 CLFS(Cross-Compiled Linux From Scratch)的文档 Version CLFS-SVN-20060417
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">  <head>    <meta http-equiv="Content-Type" content=    "application/xhtml+xml; charset=iso-8859-1" />    <title>      8.8.&nbsp;Creating the passwd, group, and log Files    </title>    <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />    <meta name="generator" content="DocBook XSL Stylesheets V1.69.1" />    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=    "text/css" media="print" />  </head>  <body id="lfs" class="CLFS-SVN-20060417-x86_64-Pure64">    <div class="navheader">      <div class="headertitles">        <h4>          Cross-Compiled Linux From Scratch - Version          CLFS-SVN-20060417-x86_64-Pure64        </h4>        <h3>          Chapter&nbsp;8.&nbsp;If You Are Going to Chroot        </h3>      </div>      <ul class="headerlinks">        <li class="prev">          <a accesskey="p" href="createfiles.html" title=          "Creating Essential Symlinks">Prev</a>          <p>            Creating Essential Symlinks          </p>        </li>        <li class="next">          <a accesskey="n" href="devices.html" title=          "Populating /dev">Next</a>          <p>            Populating /dev          </p>        </li>        <li class="up">          <a accesskey="u" href="chapter.html" title=          "Chapter&nbsp;8.&nbsp;If You Are Going to Chroot">Up</a>.        </li>        <li class="home">          <a accesskey="h" href="../index.html" title=          "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-x86_64-Pure64">          Home</a>        </li>      </ul>    </div>    <div class="sect1" lang="en" xml:lang="en">      <div class="titlepage">        <h1 class="sect1">          8.8. Creating the passwd, group, and log Files        </h1>      </div>      <p>        In order for user <tt class="systemitem">root</tt> to be able to        login and for the name &ldquo;<span class="quote">root</span>&rdquo;        to be recognized, there must be relevant entries in the <tt class=        "filename">/etc/passwd</tt> and <tt class="filename">/etc/group</tt>        files.      </p>      <p>        Create the <tt class="filename">/etc/passwd</tt> file by running the        following command:      </p>      <pre class="userinput"><kbd class="command">cat &gt; /etc/passwd &lt;&lt; "EOF"<tt class="literal">root::0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/bin/falsedaemon:x:2:2:daemon:/sbin:/bin/falseadm:x:3:4:adm:/var/adm:/bin/falselp:x:10:18:lp:/var/spool/lp:/bin/falsemail:x:30:30:mail:/var/spool/mail:/bin/falsenews:x:31:31:news:/var/spool/news:/bin/falseuucp:x:32:32:uucp:/var/spool/uucp:/bin/falseoperator:x:50:0:operator:/root:/bin/bashpostmaster:x:51:30:postmaster:/var/spool/mail:/bin/falsenobody:x:65534:65534:nobody:/:/bin/false</tt>EOF</kbd></pre>      <p>        The actual password for <tt class="systemitem">root</tt> (the        &ldquo;<span class="quote">x</span>&rdquo; used here is just a        placeholder) will be set later.      </p>      <p>        Create the <tt class="filename">/etc/group</tt> file by running the        following command:      </p>      <pre class="userinput"><kbd class="command">cat &gt; /etc/group &lt;&lt; "EOF"<tt class="literal">root::0:rootbin::1:root,bin,daemondaemon::2:root,bin,daemonsys::3:root,bin,admadm::4:root,adm,daemonkmem::5:utmp::6:tty::10:video::11:rootconsole::12:disk::13:root,admfloppy::14:rootcdrom::15:cdrw::16:tape::17:rootlp::18:lpusb::19:audio::20:dialout::21:rootmail::30:mailnews::31:newsuucp::32:uucpusers::100:nogroup::65533:nobody::65534:</tt>EOF</kbd></pre>      <p>        The created groups are not part of any standard&mdash;they are groups        decided on in part by the requirements of the Udev configuration in        the final system, and in part by common convention employed by a        number of existing Linux distributions. The Linux Standard Base (LSB,        available at <a href=        "http://www.linuxbase.org"><i>http://www.linuxbase.org</i></a>)        recommends only that, besides the group &ldquo;<span class=        "quote">root</span>&rdquo; with a Group ID (GID) of 0, a group        &ldquo;<span class="quote">bin</span>&rdquo; with a GID of 1 be        present. All other group names and GIDs can be chosen freely by the        system administrator since well-written programs do not depend on GID        numbers, but rather use the group's name.      </p>      <p>        To remove the &ldquo;<span class="quote">I have no        name!</span>&rdquo; prompt, start a new shell. Since a full Glibc was        installed in <a href="../cross-tools/chapter.html">Constructing        Cross-Compile Tools</a> and the <tt class="filename">/etc/passwd</tt>        and <tt class="filename">/etc/group</tt> files have been created,        user name and group name resolution will now work.      </p>      <pre class="userinput"><kbd class="command">exec /tools/bin/bash --login +h</kbd></pre>      <p>        Note the use of the <em class="parameter"><tt>+h</tt></em> directive.        This tells <span><strong class="command">bash</strong></span> not to        use its internal path hashing. Without this directive,        <span><strong class="command">bash</strong></span> would remember the        paths to binaries it has executed. To ensure the use of the newly        compiled binaries as soon as they are installed, the <em class=        "parameter"><tt>+h</tt></em> directive will be used for the duration        of the nexts chapters.      </p>      <p>        The <span><strong class="command">login</strong></span>,        <span><strong class="command">agetty</strong></span>, and        <span><strong class="command">init</strong></span> programs (and        others) use a number of log files to record information such as who        was logged into the system and when. However, these programs will not        write to the log files if they do not already exist. Initialize the        log files and give them proper permissions:      </p>      <pre class="userinput"><kbd class="command">touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}chgrp -v utmp /var/run/utmp /var/log/lastlogchmod -v 664 /var/run/utmp /var/log/lastlogchmod -v 600 /var/log/btmp</kbd></pre>      <p>        The <tt class="filename">/var/run/utmp</tt> file records the users        that are currently logged in. The <tt class=        "filename">/var/log/wtmp</tt> file records all logins and logouts.        The <tt class="filename">/var/log/lastlog</tt> file records when each        user last logged in. The <tt class="filename">/var/log/btmp</tt> file        records the bad login attempts.      </p>    </div>    <div class="navfooter">      <ul>        <li class="prev">          <a accesskey="p" href="createfiles.html" title=          "Creating Essential Symlinks">Prev</a>          <p>            Creating Essential Symlinks          </p>        </li>        <li class="next">          <a accesskey="n" href="devices.html" title=          "Populating /dev">Next</a>          <p>            Populating /dev          </p>        </li>        <li class="up">          <a accesskey="u" href="chapter.html" title=          "Chapter&nbsp;8.&nbsp;If You Are Going to Chroot">Up</a>.        </li>        <li class="home">          <a accesskey="h" href="../index.html" title=          "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-x86_64-Pure64">          Home</a>.        </li>      </ul>    </div>  </body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -