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