📄 addinguser.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> 4.4. Adding the LFS User </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-MIPS"> <div class="navheader"> <div class="headertitles"> <h4> Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS </h4> <h3> Chapter 4. Final Preparations </h3> </div> <ul class="headerlinks"> <li class="prev"> <a accesskey="p" href="creatingcrossdir.html" title= "Creating the $LFS/cross-tools Directory">Prev</a> <p> Creating the $LFS/cross-tools Directory </p> </li> <li class="next"> <a accesskey="n" href="settingenvironment.html" title= "Setting Up the Environment">Next</a> <p> Setting Up the Environment </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 4. Final Preparations">Up</a>. </li> <li class="home"> <a accesskey="h" href="../index.html" title= "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS"> Home</a> </li> </ul> </div> <div class="sect1" lang="en" xml:lang="en"> <div class="titlepage"> <h1 class="sect1"> 4.4. Adding the LFS User </h1> </div> <p> When logged in as user <tt class="systemitem">root</tt>, making a single mistake can damage or destroy a system. Therefore, we recommend building the packages as an unprivileged user. You could use your own user name, but to make it easier to set up a clean work environment, create a new user called <tt class="systemitem">lfs</tt> as a member of a new group (also named <tt class= "systemitem">lfs</tt>) and use this user during the installation process. As <tt class="systemitem">root</tt>, issue the following commands to add the new user: </p> <pre class="userinput"><kbd class="command">groupadd lfsuseradd -s /bin/bash -g lfs -m -k /dev/null lfs</kbd></pre> <div class="variablelist"> <p class="title"> <b>The meaning of the command line options:</b> </p> <dl> <dt> <span class="term"><em class="parameter"><tt>-s /bin/bash</tt></em></span> </dt> <dd> <p> This makes <span><strong class="command">bash</strong></span> the default shell for user <tt class="systemitem">lfs</tt>. </p> </dd> <dt> <span class="term"><em class="parameter"><tt>-g lfs</tt></em></span> </dt> <dd> <p> This option adds user <tt class="systemitem">lfs</tt> to group <tt class="systemitem">lfs</tt>. </p> </dd> <dt> <span class="term"><em class="parameter"><tt>-m</tt></em></span> </dt> <dd> <p> This creates a home directory for <tt class= "systemitem">lfs</tt>. </p> </dd> <dt> <span class="term"><em class="parameter"><tt>-k /dev/null</tt></em></span> </dt> <dd> <p> This parameter prevents possible copying of files from a skeleton directory (default is <tt class= "filename">/etc/skel</tt>) by changing the input location to the special null device. </p> </dd> <dt> <span class="term"><em class="parameter"><tt>lfs</tt></em></span> </dt> <dd> <p> This is the actual name for the created group and user. </p> </dd> </dl> </div> <p> To log in as <tt class="systemitem">lfs</tt> (as opposed to switching to user <tt class="systemitem">lfs</tt> when logged in as <tt class= "systemitem">root</tt>, which does not require the <tt class= "systemitem">lfs</tt> user to have a password), give <tt class= "systemitem">lfs</tt> a password: </p> <pre class="userinput"><kbd class="command">passwd lfs</kbd></pre> <p> Grant <tt class="systemitem">lfs</tt> full access to <tt class= "filename">$LFS</tt>, <tt class="filename">$LFS/cross-tools</tt>, and <tt class="filename">$LFS/tools</tt> by making <tt class= "systemitem">lfs</tt> the directorys' owner: </p> <pre class="userinput"><kbd class="command">chown -v lfs $LFS/toolschown -v lfs $LFS/cross-tools</kbd></pre> <p> If a separate working directory was created as suggested, give user <tt class="systemitem">lfs</tt> ownership of this directory: </p> <pre class="userinput"><kbd class="command">chown -v lfs $LFS/sources</kbd></pre> <p> Next, login as user <tt class="systemitem">lfs</tt>. This can be done via a virtual console, through a display manager, or with the following substitute user command: </p> <pre class="userinput"><kbd class="command">su - lfs</kbd></pre> <p> The “<span class="quote"><em class= "parameter"><tt>-</tt></em></span>” instructs <span><strong class="command">su</strong></span> to start a login shell as opposed to a non-login shell. The difference between these two types of shells can be found in detail in <tt class= "filename">bash(1)</tt> and <span><strong class="command">info bash</strong></span>. </p> </div> <div class="navfooter"> <ul> <li class="prev"> <a accesskey="p" href="creatingcrossdir.html" title= "Creating the $LFS/cross-tools Directory">Prev</a> <p> Creating the $LFS/cross-tools Directory </p> </li> <li class="next"> <a accesskey="n" href="settingenvironment.html" title= "Setting Up the Environment">Next</a> <p> Setting Up the Environment </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 4. Final Preparations">Up</a>. </li> <li class="home"> <a accesskey="h" href="../index.html" title= "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS"> Home</a>. </li> </ul> </div> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -