Slackware Linux Essentials: Tutorial 09

Chapter 9 Filesystem Structure
Table of Contents
9.1 Ownership
9.2 Permissions
9.3 Links
9.4 Mounting Devices
9.5 NFS Mounts

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.

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.

9.1 Ownership
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 ls command:

% ls -l /usr/bin/wc
-rwxr-xr-x 1 root bin 7368 Jul 30 1999 /usr/bin/wc


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 “root” and the group “bin” own this file.

We can easily change the file owners with the chown(1) (which means “change owner”) and chgrp(1) (which means “change group”) commands. To change the file owner to daemon, we would use chown:

# chown daemon /usr/bin/wc


To change the group owner to “root”, we would use chgrp:

# chgrp root /usr/bin/wc


We can also use chown to specify the user and group owners for a file:

# chown daemon:root /usr/bin/wc


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 chown 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: mr.jones@example.com. 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, chmod would interpret mr.jones as user “mr” and group “jones”.

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.

http://www.slackbook.org/html/filesystem-structure.html

0 comments: