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