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