slackware-current/slackbook/html/filesystem-structure.html
Patrick J Volkerding 75a4a592e5 Slackware 13.37
Mon Apr 25 13:37:00 UTC 2011
Slackware 13.37 x86_64 stable is released!

Thanks to everyone who pitched in on this release: the Slackware team,
the folks producing upstream code, and linuxquestions.org for providing
a great forum for collaboration and testing.

The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a
dual-sided
32-bit/64-bit x86/x86_64 DVD.  Please consider supporting the Slackware
project by picking up a copy from store.slackware.com.  We're taking
pre-orders now, and offer a discount if you sign up for a subscription.

As always, thanks to the Slackware community for testing, suggestions,
and feedback.  :-)

Have fun!
2018-05-31 22:45:18 +02:00

168 lines
6.1 KiB
HTML

<!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>