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

📄 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>      7.10.&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">    <div class="navheader">      <div class="headertitles">        <h4>          Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-x86        </h4>        <h3>          Chapter&nbsp;7.&nbsp;If You Are Going to Boot        </h3>      </div>      <ul class="headerlinks">        <li class="prev">          <a accesskey="p" href="udev.html" title="Udev-090">Prev</a>          <p>            Udev-090          </p>        </li>        <li class="next">          <a accesskey="n" href="kernel.html" title="Linux-2.6.16.5">Next</a>          <p>            Linux-2.6.16.5          </p>        </li>        <li class="up">          <a accesskey="u" href="chapter.html" title=          "Chapter&nbsp;7.&nbsp;If You Are Going to Boot">Up</a>.        </li>        <li class="home">          <a accesskey="h" href="../index.html" title=          "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-x86">          Home</a>        </li>      </ul>    </div>    <div class="sect1" lang="en" xml:lang="en">      <div class="titlepage">        <h1 class="sect1">          7.10. 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">${LFS}/etc/passwd</tt> and <tt class=        "filename">${LFS}/etc/group</tt> files.      </p>      <p>        Create the <tt class="filename">${LFS}/etc/passwd</tt> file by        running the following command:      </p>      <pre class="userinput"><kbd class="command">cat &gt; ${LFS}/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">${LFS}/etc/group</tt> file by running        the following command:      </p>      <pre class="userinput"><kbd class="command">cat &gt; ${LFS}/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>        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 ${LFS}/var/run/utmp ${LFS}/var/log/{btmp,lastlog,wtmp}chmod -v 664 ${LFS}/var/run/utmp ${LFS}/var/log/lastlogchmod -v 600 ${LFS}/var/log/btmp</kbd></pre>      <p>        The <tt class="filename">${LFS}/var/run/utmp</tt> file records the        users that are currently logged in. The <tt class=        "filename">${LFS}/var/log/wtmp</tt> file records all logins and        logouts. The <tt class="filename">${LFS}/var/log/lastlog</tt> file        records when each user last logged in. The <tt class=        "filename">${LFS}/var/log/btmp</tt> file records the bad login        attempts.      </p>    </div>    <div class="navfooter">      <ul>        <li class="prev">          <a accesskey="p" href="udev.html" title="Udev-090">Prev</a>          <p>            Udev-090          </p>        </li>        <li class="next">          <a accesskey="n" href="kernel.html" title="Linux-2.6.16.5">Next</a>          <p>            Linux-2.6.16.5          </p>        </li>        <li class="up">          <a accesskey="u" href="chapter.html" title=          "Chapter&nbsp;7.&nbsp;If You Are Going to Boot">Up</a>.        </li>        <li class="home">          <a accesskey="h" href="../index.html" title=          "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-x86">          Home</a>.        </li>      </ul>    </div>  </body></html>

⌨️ 快捷键说明

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