creatingdirs.xml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. %general-entities;
  5. ]>
  6. <sect1 id="ch-system-creatingdirs">
  7. <title>Creating directories</title>
  8. <?dbhtml filename="creatingdirs.html"?>
  9. <para>Let's now create some structure in our LFS file system. Let's create
  10. a directory tree. Issuing the following commands will create a more or less
  11. standard tree:</para>
  12. <screen><userinput>mkdir -p /{bin,boot,dev,etc/opt,home,lib,mnt}
  13. mkdir -p /{root,sbin,srv,tmp,usr/local,var,opt}
  14. mkdir -p /media/{floppy,cdrom}
  15. mkdir /usr/{bin,include,lib,sbin,share,src}
  16. ln -s share/{man,doc,info} /usr
  17. mkdir /usr/share/{doc,info,locale,man}
  18. mkdir /usr/share/{misc,terminfo,zoneinfo}
  19. mkdir /usr/share/man/man{1,2,3,4,5,6,7,8}
  20. mkdir /usr/local/{bin,etc,include,lib,sbin,share,src}
  21. ln -s share/{man,doc,info} /usr/local
  22. mkdir /usr/local/share/{doc,info,locale,man}
  23. mkdir /usr/local/share/{misc,terminfo,zoneinfo}
  24. mkdir /usr/local/share/man/man{1,2,3,4,5,6,7,8}
  25. mkdir /var/{lock,log,mail,run,spool}
  26. mkdir -p /var/{tmp,opt,cache,lib/{misc,locate},local}
  27. mkdir /opt/{bin,doc,include,info}
  28. mkdir -p /opt/{lib,man/man{1,2,3,4,5,6,7,8}}</userinput></screen>
  29. <para>Directories are, by default, created with permission mode 755, but this
  30. isn't desirable for all directories. We will make two changes: one to the home
  31. directory of <emphasis>root</emphasis>, and another to the directories for
  32. temporary files.</para>
  33. <screen><userinput>chmod 0750 /root
  34. chmod 1777 /tmp /var/tmp</userinput></screen>
  35. <para>The first mode change ensures that not just anybody can enter the
  36. <filename class="directory">/root</filename> directory -- the same
  37. as a normal user would do with his or her home directory.
  38. The second mode change makes sure that any user can write to the
  39. <filename class="directory">/tmp</filename> and
  40. <filename class="directory">/var/tmp</filename> directories, but
  41. cannot remove other users' files from them. The latter is prohibited
  42. by the so-called <quote>sticky bit</quote> -- the highest bit in the 1777 bit
  43. mask.</para>
  44. <sect2>
  45. <title>FHS compliance note</title>
  46. <para>We have based our directory tree on the FHS standard (available at
  47. <ulink url="http://www.pathname.com/fhs/"/>). Besides the above created
  48. tree this standard stipulates the existence of
  49. <filename class="directory">/usr/local/games</filename> and
  50. <filename class="directory">/usr/share/games</filename>, but we don't
  51. much like these for a base system. However, feel free to make your system
  52. FHS-compliant. As to the structure of the
  53. <filename class="directory">/usr/local/share</filename> subdirectory, the FHS
  54. isn't precise, so we created here the directories that we think are needed.</para>
  55. </sect2>
  56. </sect1>