summaryrefslogtreecommitdiffstats
path: root/slackbook/html/filesystem-structure.html
blob: 843c07c5d9ca71de22e0c970612542de2c864808 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Filesystem Structure</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="PREVIOUS" title="Virtual Terminals" href="shell-vt.html" />
<link rel="NEXT" title="Permissions" href="filesystem-structure-permissions.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="CHAPTER" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>

<tr>
<td width="10%" align="left" valign="bottom"><a href="shell-vt.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom"></td>
<td width="10%" align="right" valign="bottom"><a
href="filesystem-structure-permissions.html" accesskey="N">Next</a></td>
</tr>
</table>

<hr align="LEFT" width="100%" />
</div>

<div class="CHAPTER">
<h1><a id="FILESYSTEM-STRUCTURE" name="FILESYSTEM-STRUCTURE"></a>Chapter 9 Filesystem
Structure</h1>

<div class="TOC">
<dl>
<dt><b>Table of Contents</b></dt>

<dt>9.1 <a
href="filesystem-structure.html#FILESYSTEM-STRUCTURE-OWNERSHIP">Ownership</a></dt>

<dt>9.2 <a href="filesystem-structure-permissions.html">Permissions</a></dt>

<dt>9.3 <a href="filesystem-structure-links.html">Links</a></dt>

<dt>9.4 <a href="filesystem-structure-mounting.html">Mounting Devices</a></dt>

<dt>9.5 <a href="filesystem-structure-nfs.html">NFS Mounts</a></dt>
</dl>
</div>

<p>We have already discussed the directory structure in Slackware Linux. By this point,
you should be able to find files and directories that you need. But there is more to the
filesystem than just the directory structure.</p>

<p>Linux is a multiuser operating system. Every aspect of the system is multiuser, even
the filesystem. The system stores information like who owns a file and who can read it.
There are other unique parts about the filesystems, such as links and NFS mounts. This
section explains these, as well as the multiuser aspects of the filesystem.</p>

<div class="SECT1">
<h1 class="SECT1"><a id="FILESYSTEM-STRUCTURE-OWNERSHIP"
name="FILESYSTEM-STRUCTURE-OWNERSHIP">9.1 Ownership</a></h1>

<p>The filesystem stores ownership information for each file and directory on the system.
This includes what user and group own a particular file. The easiest way to see this
information is with the <tt class="COMMAND">ls</tt> command:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /usr/bin/wc</kbd>
-rwxr-xr-x   1 root     bin    7368 Jul 30  1999 /usr/bin/wc
</pre>
</td>
</tr>
</table>

<p>We are interested in the third and fourth columns. These contain the username and
group name that owns this file. We see that the user &#8220;<tt
class="USERNAME">root</tt>&#8221; and the group &#8220;<tt
class="USERNAME">bin</tt>&#8221; own this file.</p>

<p>We can easily change the file owners with the <tt class="COMMAND">chown</tt>(1) (which
means &#8220;change owner&#8221;) and <tt class="COMMAND">chgrp</tt>(1) (which means
&#8220;change group&#8221;) commands. To change the file owner to <tt
class="USERNAME">daemon</tt>, we would use <tt class="COMMAND">chown</tt>:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">chown daemon /usr/bin/wc</kbd>
</pre>
</td>
</tr>
</table>

<p>To change the group owner to &#8220;<tt class="USERNAME">root</tt>&#8221;, we would
use <tt class="COMMAND">chgrp</tt>:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">chgrp root /usr/bin/wc</kbd>
</pre>
</td>
</tr>
</table>

<p>We can also use <tt class="COMMAND">chown</tt> to specify the user and group owners
for a file:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">chown daemon:root /usr/bin/wc</kbd>
</pre>
</td>
</tr>
</table>

<p>In the above example, the user could have used a period instead of a colon. The result
would have been the same; however, the colon is considered better form. Use of the period
is deprecated and may be removed from future versions of <tt class="COMMAND">chown</tt>
to allow usernames with periods in them. These usernames tend to be very popular with
Windows Exchange Servers and are encountered most commonly in email addresses such as:
<var class="LITERAL">mr.jones@example.com</var>. In slackware, administrators are advised
to stay away from such usernames because some scripts still use the period to indicate
the user and group of a file or directory. In our example, <tt class="COMMAND">chmod</tt>
would interpret <var class="LITERAL">mr.jones</var> as user &#8220;mr&#8221; and group
&#8220;jones&#8221;.</p>

<p>File ownership is a very important part of using a Linux system, even if you are the
only user. You sometimes need to fix ownerships on files and device nodes.</p>
</div>
</div>

<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="shell-vt.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a
href="filesystem-structure-permissions.html" accesskey="N">Next</a></td>
</tr>

<tr>
<td width="33%" align="left" valign="top">Virtual Terminals</td>
<td width="34%" align="center" valign="top">&nbsp;</td>
<td width="33%" align="right" valign="top">Permissions</td>
</tr>
</table>
</div>
</body>
</html>