1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="ch-final-system-creatingdirs">
|
---|
9 | <?dbhtml filename="creatingdirs.html"?>
|
---|
10 |
|
---|
11 | <title>Creating Directories</title>
|
---|
12 |
|
---|
13 | <para>It is time to create some structure in the target CLFS file system.
|
---|
14 | Create a standard directory tree by issuing the following commands:</para>
|
---|
15 |
|
---|
16 | <screen><userinput>mkdir -pv ${CLFS}/targetfs/{bin,boot,dev,etc,home,lib/{firmware,modules}}
|
---|
17 | mkdir -pv ${CLFS}/targetfs/{mnt,opt,proc,sbin,srv,sys}
|
---|
18 | mkdir -pv ${CLFS}/targetfs/var/{cache,lib,local,lock,log,opt,run,spool}
|
---|
19 | install -dv -m 0750 ${CLFS}/targetfs/root
|
---|
20 | install -dv -m 1777 ${CLFS}/targetfs/{var/,}tmp
|
---|
21 | mkdir -pv ${CLFS}/targetfs/usr/{,local/}{bin,include,lib,sbin,share,src}</userinput></screen>
|
---|
22 |
|
---|
23 | <para>Directories are, by default, created with permission mode 755, but
|
---|
24 | this is not desirable for all directories. In the commands above, two
|
---|
25 | changes are made—one to the home directory of user <systemitem
|
---|
26 | class="username">root</systemitem>, and another to the directories for
|
---|
27 | temporary files.</para>
|
---|
28 |
|
---|
29 | <para>The first mode change ensures that not just anybody can enter
|
---|
30 | the <filename class="directory">/root</filename> directory—the
|
---|
31 | same as a normal user would do with his or her home directory. The
|
---|
32 | second mode change makes sure that any user can write to the
|
---|
33 | <filename class="directory">/tmp</filename> and <filename
|
---|
34 | class="directory">/var/tmp</filename> directories, but cannot remove
|
---|
35 | another user's files from them. The latter is prohibited by the so-called
|
---|
36 | <quote>sticky bit,</quote> the highest bit (1) in the 1777 bit mask.</para>
|
---|
37 |
|
---|
38 | <sect2>
|
---|
39 | <title>FHS Compliance Note</title>
|
---|
40 |
|
---|
41 | <para>The directory tree is based on the Filesystem Hierarchy Standard (FHS)
|
---|
42 | (available at <ulink url="http://www.pathname.com/fhs/"/>).</para>
|
---|
43 |
|
---|
44 | </sect2>
|
---|
45 |
|
---|
46 | </sect1>
|
---|