ACC SHELL
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 6. Basic Concepts</title><link rel="stylesheet" href="susebooks.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Documentation"><link rel="up" href="part.basics.html" title="Part II. Basics"><link rel="prev" href="part.basics.html" title="Part II. Basics"><link rel="next" href="cha.new.bash.html" title="Chapter 7. Shell Basics"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header" border="0" class="bctable"><tr><td width="80%"><div class="breadcrumbs"><p><a href="index.html"> Documentation</a><span class="breadcrumbs-sep"> > </span><a href="book.opensuse.startup.html">Start-Up</a><span class="breadcrumbs-sep"> > </span><a href="part.basics.html">Basics</a><span class="breadcrumbs-sep"> > </span><strong><a accesskey="p" title="Part II. Basics" href="part.basics.html"><span>◀</span></a> <a accesskey="n" title="Chapter 7. Shell Basics" href="cha.new.bash.html"><span>▶</span></a></strong></p></div></td></tr></table></div><div class="chapter" title="Chapter 6. Basic Concepts"><div class="titlepage"><div><div><h2 class="title"><a name="cha.new"></a>Chapter 6. Basic Concepts<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#cha.new">¶</a></span></h2></div></div></div><div class="toc"><p><b>Contents</b></p><dl><dt><span class="sect1"><a href="cha.new.html#sec.new.users">6.1. User Concept</a></span></dt><dt><span class="sect1"><a href="cha.new.html#sec.new.fs">6.2. The Linux File System</a></span></dt><dt><span class="sect1"><a href="cha.new.html#sec.new.users.accperm">6.3. File Access Permissions</a></span></dt></dl></div><a class="indexterm" name="id355589"></a><div class="abstract" title="Abstract"><p class="title"><b>Abstract</b></p><p>
If this is your first encounter with a Linux system you probably want to
learn something about the basic concepts of Linux before getting started.
The graphical user interfaces of Linux, Mac OS* and
Windows* show rather similar desktop components, which makes it
easy to move from one graphical environment to the next. However, if you
take a look at the underlying system you will soon notice some
differences.
</p><p>
The following sections are meant to guide you through the first steps
with your Linux system and to help Linux <span class="quote">“<span class="quote">newbies</span>”</span> to
familiarize themselves in their new operating system. You will learn
about the user concept of Linux, the structure of the Linux file system
(where to find what in the directory tree) and how to deal with access
permissions for files and directories, which are an essential feature in
Linux.
</p><p>
Users who have been working with Mac OS will probably recognize that the
concepts explained in the following sections are rather similar to what
they know already from Mac OS. Windows users may realize some crucial
differences which are worth noticing.
</p></div><div class="sect1" title="6.1. User Concept"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.new.users"></a>6.1. User Concept<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.new.users">¶</a></span></h2></div></div></div><a class="indexterm" name="id355637"></a><a class="indexterm" name="id355645"></a><p>
From the beginning, Linux has been designed as a multiuser system: Any
number of users can simultaneously work on one machine. These users can
connect to the system via different terminals or network connections.
Usually users need to log in to the system before starting a session.
Personal information and individual desktop configuration are stored
separately for each user.
</p><div class="sect2" title="6.1.1. Distinct User Roles"><div class="titlepage"><div><div><h3 class="title"><a name="sec.new.users.roles"></a>6.1.1. Distinct User Roles<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.new.users.roles">¶</a></span></h3></div></div></div><a class="indexterm" name="id355666"></a><a class="indexterm" name="id355674"></a><a class="indexterm" name="id355681"></a><a class="indexterm" name="id355688"></a><p>
Among the users working on a machine, Linux distinguishes between
different kinds of user roles: you can log in to a Linux machine as a
<span class="quote">“<span class="quote">normal</span>”</span> user or as a superuser (administrator),
traditionally called <code class="systemitem">root</code> in Linux. The superuser has privileges
which authorize him to access all parts of the system and to execute
administrative tasks. He or she has the unrestricted capacity to make
changes to the system and has unlimited access to all files. If you are
logged in as a normal user you lack these privileges. User and <code class="systemitem">root</code>
can of course be the same physical person but acting in different roles.
</p><p>
The <code class="systemitem">root</code> user account is always created on your Linux system by
default — during installation you are therefore requested to
specify a password for <code class="systemitem">root</code>. Which other users can log in to your
system depends on the method of authentication you choose during
installation (see <a class="xref" href="cha.inst.html#sec.i.yast2.user" title="1.11. Create New User">Section 1.11, “Create New User”</a>).
</p><p>
For your daily work, you usually log in to your system as normal user.
Performing some administrative tasks or running certain programs such as
YaST requires <code class="systemitem">root</code> permissions. You can easily switch from your
normal account to <code class="systemitem">root</code> and back to your normal user account after
accomplishing the administrative task. How to do so in a shell is
described in <a class="xref" href="cha.new.bash.html#sec.new.bash.root" title="7.4. Becoming Root">Section 7.4, “Becoming Root”</a>. If you are working with
a graphical user interface you are usually prompted to enter the
<code class="systemitem">root</code> password when necessary. Closing the application which
required <code class="systemitem">root</code> permissions results in withdrawal of the <code class="systemitem">root</code>
privileges: you automatically switch back to your normal user account.
</p><p>
<a class="indexterm" name="id355777"></a> While this concept might not look very appealing at first,
it adds to security. A user without <code class="systemitem">root</code> privileges cannot damage
the entire system. Any damage caused is strictly limited to the user's
own account and data. Any operation executed with <code class="systemitem">root</code> privileges
may potentially harm the entire system. Anyone intending to harm a
running Linux system must gain <code class="systemitem">root</code> privileges first. This is why
it is much harder to create viruses for Linux systems. They must overcome
the root barrier first.
</p></div><div class="sect2" title="6.1.2. Groups"><div class="titlepage"><div><div><h3 class="title"><a name="sec.new.users.groups"></a>6.1.2. Groups<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.new.users.groups">¶</a></span></h3></div></div></div><a class="indexterm" name="id355816"></a><a class="indexterm" name="id355823"></a><p>
Every user in a Linux system belongs at least to one group. A group, in
this case, can be defined as a set of connected users with certain
collective privileges. Groups are usually defined according to functional
roles or the data and resources the members of the group need to access.
When a new user account is created on your system, the user is usually
assigned to a default, primary group. The system administrator can change
this primary group or assign the user to an additional group, if
necessary.
</p><div class="figure"><a name="fig.new.users.yast.group"></a><p class="title"><b>Figure 6.1. Group Membership for a User in YaST</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#fig.new.users.yast.group">¶</a></span></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0" width="70%"><tr><td><img src="images/yast2_user_group_assign_gtk.png" width="100%" alt="Group Membership for a User in YaST"></td></tr></table></div></div></div><br class="figure-break"></div></div><div class="sect1" title="6.2. The Linux File System"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.new.fs"></a>6.2. The Linux File System<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.new.fs">¶</a></span></h2></div></div></div><a class="indexterm" name="id355891"></a><a class="indexterm" name="id355898"></a><p>
All users, including the superuser, have their own home directories where
all private data, like documents, bookmarks, or e-mail, are stored. System
directories holding central configuration files or executable files can
only be modified by the superuser. Read more about access permissions and
how to modify them according to your needs in
<a class="xref" href="cha.new.bash.html#sec.new.bash.perm" title="7.5. Modifying File Permissions">Section 7.5, “Modifying File Permissions”</a>.
</p><p>
In Linux, you can choose whether you want to manage files and folders with
a file manager or with the command line, which is the traditional way. The
latter method is often faster but requires some deeper knowledge of
several commands to list, create, delete, or edit files and their
properties. For more information about commands for manipulating files
refer to <a class="xref" href="cha.new.bash.html#sec.new.bash.fildir" title="7.3. Working with Files and Directories">Section 7.3, “Working with Files and Directories”</a>. A file manager provides a
graphical and more intuitive way to handle these tasks. Learn more about
the file managers of GNOME and KDE in
Section “Managing Folders and Files with Nautilus” (Chapter 2, <i>Working with Your Desktop</i>, ↑GNOME User Guide) and
Section “Using Dolphin File Manager” (Chapter 2, <i>Working with Your Desktop</i>, ↑KDE User Guide). The following sections provide you with
some basic knowledge of the file system and provide an overview of the
default directory structure in Linux.
</p><div class="sect2" title="6.2.1. Key Features"><div class="titlepage"><div><div><h3 class="title"><a name="sec.new.fs.concept"></a>6.2.1. Key Features<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.new.fs.concept">¶</a></span></h3></div></div></div><p>
In Linux, all files and directories are located in a tree-like structure.
The topmost directory is referred to as the file system
<span class="emphasis"><em>root</em></span> or just <code class="literal">/</code> (not to be
confused with the <code class="systemitem">root</code> user). The counterpart of
<code class="filename">/</code> in a Windows system would probably be
<code class="filename">C:\</code>. All other directories in Linux can be accessed
from the root directory and are arranged in a hierarchical structure.
</p><p>
Find the key features of the Linux file system in the following list
which also highlights some of the major differences between the Linux and
the Windows/DOS file system:
</p><div class="variablelist"><dl><dt><span class="term">Specifying Paths<a class="indexterm" name="id355978"></a></span></dt><dd><p>
As opposed to Windows, Linux does not use backslashes to separate the
components of a pathname, it uses slashes instead. For example, the
private data of users in Windows may be stored under <code class="filename">C:\My
Documents\Letters</code>, whereas in Linux it would be stored
under
<code class="filename">/home/<em class="replaceable"><code>username</code></em>/Letters</code>.
</p></dd><dt><span class="term">Partitions, Drives/Devices and Directories<a class="indexterm" name="id356010"></a><a class="indexterm" name="id356017"></a><a class="indexterm" name="id356025"></a></span></dt><dd><p>
Linux does not use drive letters as Windows does. From the mere
appearance of a pathname in Linux you can not tell whether you are
addressing a partition, a drive/device, a network device or an
<span class="quote">“<span class="quote">ordinary</span>”</span> directory.
</p></dd><dt><span class="term">Mounting and Unmounting<a class="indexterm" name="id356050"></a><a class="indexterm" name="id356058"></a><a class="indexterm" name="id356065"></a><a class="indexterm" name="id356072"></a><a class="indexterm" name="id356080"></a><a class="indexterm" name="id356087"></a><a class="indexterm" name="id356095"></a><a class="indexterm" name="id356102"></a><a class="indexterm" name="id356110"></a><a class="indexterm" name="id356117"></a></span></dt><dd><p>
Another crucial difference between Windows/DOS and Linux is the
concept of <span class="emphasis"><em>mounting</em></span> and
<span class="emphasis"><em>unmounting</em></span> partitions, drives or directories.
Windows detects partitions and drives during the boot process and
assigns a drive letter to them. In Linux, however, partitions or
devices are usually not visible in the directory tree unless they are
<span class="emphasis"><em>mounted</em></span>, that means integrated into the file
system at a specific location in the directory tree. As a normal user
you cannot access data on a partition or a device unless it is
mounted. But don't worry— most of the time you do not have to
mount partitions or devices manually. During the installation of your
system, you can define partitions to be mounted automatically when the
system is started. Removable devices are usually also detected and
mounted automatically by your system. The desktop environments such as
KDE or GNOME will inform you about the appearance of a new device.
</p><div class="figure"><a name="fig.new.fs.autodetect"></a><p class="title"><b>Figure 6.2. Autodetection of a USB Stick in KDE</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#fig.new.fs.autodetect">¶</a></span></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0" width="40%"><tr><td><img src="images/kde_device_notifier.png" width="100%" alt="Autodetection of a USB Stick in KDE"></td></tr></table></div></div></div><br class="figure-break"><p>
Although this concept of mounting and unmounting may appear
complicated or cumbersome at first sight this also offers great
flexibility. For example you can easily mount a directory from a
another machine over the network and act on that directory as though
it were located on your local machine.
</p></dd><dt><span class="term">Case-Sensitivity<a class="indexterm" name="id356196"></a><a class="indexterm" name="id356204"></a><a class="indexterm" name="id356211"></a></span></dt><dd><p>
Linux distinguishes between uppercase and lowercase letters in the
file system. For example, whether you name a file
<code class="filename">test.txt</code>, <code class="filename">TeST.txt</code> or
<code class="filename">Test.txt</code> makes a difference in Linux. This also
holds true for directories: You cannot access a directory named
<code class="filename">Letters</code> by the name <code class="filename">letters</code>.
</p></dd><dt><span class="term">File Extensions<a class="indexterm" name="id356250"></a></span></dt><dd><p>
As opposed to Windows, files in Linux <span class="emphasis"><em>may</em></span> have a
file extension, such as <code class="literal">.txt</code>, but do not need to
have one. When you start working with the shell this sometimes makes
it difficult for beginners to differentiate between files and folders,
depending on the command you use to list the contents of a directory.
Learn more about some basic shell commands in
<a class="xref" href="cha.new.bash.html" title="Chapter 7. Shell Basics">Chapter 7, <i>Shell Basics</i></a>. If you use the graphical file managers
in GNOME or KDE (see Section “Managing Folders and Files with Nautilus” (Chapter 2, <i>Working with Your Desktop</i>, ↑GNOME User Guide)
and Section “Using Dolphin File Manager” (Chapter 2, <i>Working with Your Desktop</i>, ↑KDE User Guide)) files and folders are
symbolized by various different icons depending on the view you
choose.
</p><div class="figure"><a name="fig.new.fs.fileman"></a><p class="title"><b>Figure 6.3. File and Folders in KDE File Manager</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#fig.new.fs.fileman">¶</a></span></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0" width="70%"><tr><td><img src="images/kde_dolphin_filesymbols.png" width="100%" alt="File and Folders in KDE File Manager"></td></tr></table></div></div></div><br class="figure-break"></dd><dt><span class="term">Hidden Files<a class="indexterm" name="id356327"></a></span></dt><dd><p>
Similar to Windows, Linux also distinguishes between
<span class="quote">“<span class="quote">normal</span>”</span> files and <span class="emphasis"><em>hidden files</em></span>
which are often configuration files that you usually do not want to
access or see as a normal user. In Linux, hidden files are indicated
by a dot in front (for example, <code class="literal">.hiddenfile</code>). In
order to access hidden files you can switch view in the file managers
as described in Section “Using Dolphin File Manager” (Chapter 2, <i>Working with Your Desktop</i>, ↑KDE User Guide) or use a certain
command in the shell as described in
<a class="xref" href="cha.new.bash.html#sec.new.bash.commands.options" title="7.2.2. Using Commands with Options">Section 7.2.2, “Using Commands with Options”</a>.
</p></dd><dt><span class="term">File System Permissions<a class="indexterm" name="id356368"></a></span></dt><dd><p>
Because Linux is a multiuser system, every file in a Linux file system
belongs to a user and a group. Only the owner of a file or directory
(or, of course, <code class="systemitem">root</code>) can grant other users access permission to
it. Linux basically distinguishes between three different types of
access permissions: write permission, read permission and execute
permission. You can only access a file or a folder if you have at
least read permission to it. There are several ways to change the
access permissions of files and folders: either traditionally via the
shell or with the help of your desktop's file manager.
If you have <code class="systemitem">root</code> privileges, you can also change the owner and
the group of a file or folder. Read how to do so in a shell in
<a class="xref" href="cha.new.bash.html#sec.new.bash.perm" title="7.5. Modifying File Permissions">Section 7.5, “Modifying File Permissions”</a>.
</p><p>
For more detailed information about file system permissions refer to
<a class="xref" href="cha.new.html#sec.new.users.accperm" title="6.3. File Access Permissions">Section 6.3, “File Access Permissions”</a>. Apart from the traditional
permission concept for file system objects there are also extensions
available which handle permissions more flexibly. Read more in
Chapter <i>Access Control Lists in Linux</i> (↑Security Guide).
</p></dd></dl></div></div><div class="sect2" title="6.2.2. The Directory Structure"><div class="titlepage"><div><div><h3 class="title"><a name="id356426"></a>6.2.2. The Directory Structure<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#id356426">¶</a></span></h3></div></div></div><a class="indexterm" name="id356432"></a><p>
The following table provides a short overview of the most important
higher-level directories that you find on a Linux system. Find more
detailed information about the directories and important subdirectories in
the following list.
</p><div class="table"><a name="id356446"></a><p class="title"><b>Table 6.1. Overview of a Standard Directory Tree</b></p><div class="table-contents"><table summary="Overview of a Standard Directory Tree" border="1"><colgroup><col><col></colgroup><thead><tr><th>
<p>
Directory
</p>
</th><th>
<p>
Contents
</p>
</th></tr></thead><tbody><tr><td>
<p>
<code class="filename">/</code> <a class="indexterm" name="id356486"></a>
</p>
</td><td>
<p>
Root directory—the starting point of the directory tree.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/bin</code> <a class="indexterm" name="id356515"></a>
</p>
</td><td>
<p>
Essential binary files, such as commands that are needed by both the
system administrator and normal users. Usually also contains the
shells, such as Bash.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/boot</code> <a class="indexterm" name="id356546"></a>
</p>
</td><td>
<p>
Static files of the boot loader.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/dev</code> <a class="indexterm" name="id356575"></a>
</p>
</td><td>
<p>
Files needed to access host-specific devices.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/etc</code> <a class="indexterm" name="id356603"></a>
</p>
</td><td>
<p>
Host-specific system configuration files.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/home</code> <a class="indexterm" name="id356632"></a>
</p>
</td><td>
<p>
Holds the home directories of all users who have accounts on the
system. However, <code class="systemitem">root</code>'s home directory is not located in
<code class="filename">/home</code> but in <code class="filename">/root</code>.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/lib</code> <a class="indexterm" name="id356674"></a>
</p>
</td><td>
<p>
Essential shared libraries and kernel modules.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/media</code> <a class="indexterm" name="id356702"></a>
</p>
</td><td>
<p>
Mount points for removable media.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/mnt</code> <a class="indexterm" name="id356731"></a>
</p>
</td><td>
<p>
Mount point for temporarily mounting a file system.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/opt</code> <a class="indexterm" name="id356760"></a>
</p>
</td><td>
<p>
Add-on application software packages.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/root</code> <a class="indexterm" name="id356789"></a>
</p>
</td><td>
<p>
Home directory for the superuser <code class="systemitem">root</code>.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/sbin</code> <a class="indexterm" name="id356823"></a>
</p>
</td><td>
<p>
Essential system binaries.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/srv</code> <a class="indexterm" name="id356852"></a>
</p>
</td><td>
<p>
Data for services provided by the system.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/tmp</code> <a class="indexterm" name="id356880"></a>
</p>
</td><td>
<p>
Temporary files.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/usr</code> <a class="indexterm" name="id356909"></a>
</p>
</td><td>
<p>
Secondary hierarchy with read-only data.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/var</code> <a class="indexterm" name="id356938"></a>
</p>
</td><td>
<p>
Variable data such as log files.
</p>
</td></tr><tr><td>
<p>
<code class="filename">/windows</code> <a class="indexterm" name="id356967"></a>
</p>
</td><td>
<p>
Only available if you have both Microsoft Windows* and Linux
installed on your system. Contains the Windows data.
</p>
</td></tr></tbody></table></div></div><br class="table-break"><p>
The following list provides more detailed information and gives some
examples of which files and subdirectories can be found in the
directories:
</p><div class="variablelist"><dl><dt><span class="term"><code class="filename">/bin</code><a class="indexterm" name="id357002"></a>
</span></dt><dd><p>
Contains the basic shell commands that may be used both by <code class="systemitem">root</code>
and by other users. These commands include <span class="command"><strong>ls</strong></span>,
<span class="command"><strong>mkdir</strong></span>, <span class="command"><strong>cp</strong></span>, <span class="command"><strong>mv</strong></span>,
<span class="command"><strong>rm</strong></span> and <span class="command"><strong>rmdir</strong></span>.
<code class="filename">/bin</code> also contains Bash, the default shell in
openSUSE.
</p></dd><dt><span class="term"><code class="filename">/boot</code><a class="indexterm" name="id357055"></a>
</span></dt><dd><p>
Contains data required for booting, such as the boot loader, the
kernel, and other data that is used before the kernel begins executing
user-mode programs.
</p></dd><dt><span class="term"><code class="filename">/dev</code><a class="indexterm" name="id357079"></a>
</span></dt><dd><p>
Holds device files that represent hardware components.
</p></dd><dt><span class="term"><code class="filename">/etc</code><a class="indexterm" name="id357101"></a>
</span></dt><dd><p>
Contains local configuration files that control the operation of
programs like the X Window System. The <code class="filename">/etc/init.d</code>
subdirectory contains scripts that are executed during the boot
process.
</p></dd><dt><span class="term"><code class="filename">/home/<em class="replaceable"><code>username</code></em></code><a class="indexterm" name="id357131"></a>
</span></dt><dd><p>
Holds the private data of every user who has an account on the system.
The files located here can only be modified by their owner or by the
system administrator. By default, your e-mail directory and personal
desktop configuration are located here in the form of hidden files and
directories. KDE users find the personal configuration data for their
desktop in <code class="filename">.kde4</code> and GNOME users find it in
<code class="filename">.gconf</code>. <span>For information about
hidden files, refer to <a class="xref" href="cha.new.html#sec.new.fs.concept" title="6.2.1. Key Features">Section 6.2.1, “Key Features”</a>.</span>
</p><div class="note"><table border="0" cellpadding="3" cellspacing="0" width="100%" summary="Note: Home Directory in a Network Environment"><tr class="head"><td width="32"><img alt="[Note]" src="admon/note.png"></td><th align="left">Home Directory in a Network Environment</th></tr><tr><td colspan="2" align="left" valign="top"><p>
If you are working in a network environment, your home directory may
be mapped to a directory in the file system other than
<code class="filename">/home</code>.
</p></td></tr></table></div></dd><dt><span class="term"><code class="filename">/lib</code><a class="indexterm" name="id357188"></a>
</span></dt><dd><p>
Contains the essential shared libraries needed to boot the system and
to run the commands in the root file system. The Windows equivalent for
shared libraries are DLL files.
</p></dd><dt><span class="term"><code class="filename">/media</code><a class="indexterm" name="id357215"></a>
</span></dt><dd><p>
Contains mount points for removable media, such as CD-ROMs, USB sticks
and digital cameras (if they use USB). <code class="filename">/media</code>
generally holds any type of drive except the hard drive of your system.
As soon as your removable medium has been inserted or connected to the
system and has been mounted, you can access it from here.
</p></dd><dt><span class="term"><code class="filename">/mnt</code><a class="indexterm" name="id357248"></a>
</span></dt><dd><p>
This directory provides a mount point for a temporarily mounted file
system. <code class="systemitem">root</code> may mount file systems here.
</p></dd><dt><span class="term"><code class="filename">/opt</code><a class="indexterm" name="id357280"></a>
</span></dt><dd><p>
Reserved for the installation of third-party software. Optional
software and larger add-on program packages can be found here.
</p></dd><dt><span class="term"><code class="filename">/root</code><a class="indexterm" name="id357307"></a>
</span></dt><dd><p>
Home directory for the <code class="systemitem">root</code> user. The personal data of <code class="systemitem">root</code>
is located here.
</p></dd><dt><span class="term"><code class="filename">/sbin</code><a class="indexterm" name="id357346"></a>
</span></dt><dd><p>
As the <code class="literal">s</code> indicates, this directory holds utilities
for the superuser. <code class="filename">/sbin</code> contains the binaries
essential for booting, restoring and recovering the system in addition
to the binaries in <code class="filename">/bin</code>.
</p></dd><dt><span class="term"><code class="filename">/srv</code><a class="indexterm" name="id357384"></a>
</span></dt><dd><p>
Holds data for services provided by the system, such as FTP and HTTP.
</p></dd><dt><span class="term"><code class="filename">/tmp</code><a class="indexterm" name="id357410"></a>
</span></dt><dd><p>
This directory is used by programs that require temporary storage of
files.
</p><div class="important"><table border="0" cellpadding="3" cellspacing="0" width="100%" summary="Important: Cleaning up /tmp at Boot Time"><tr class="head"><td width="32"><img alt="[Important]" src="admon/important.png"></td><th align="left">Cleaning up <code class="filename">/tmp</code> at Boot Time</th></tr><tr><td colspan="2" align="left" valign="top"><p>
Data stored in <code class="filename">/tmp</code> are not guaranteed to survive
a system reboot. It depends, for example, on settings in
<code class="filename">/etc/sysconfig/cron</code>.
</p></td></tr></table></div></dd><dt><span class="term"><code class="filename">/usr</code><a class="indexterm" name="id357460"></a>
</span></dt><dd><p>
<code class="literal">/usr</code> has nothing to do with users, but is the
acronym for UNIX system resources. The data in
<code class="filename">/usr</code> is static, read-only data that can be shared
among various hosts compliant with the Filesystem Hierarchy Standard
(FHS). This directory contains all application programs and establishes
a secondary hierarchy in the file system. KDE4 and GNOME are also
located here. <code class="filename">/usr</code> holds a number of
subdirectories, such as <code class="filename">/usr/bin</code>,
<code class="filename">/usr/sbin</code>, <code class="filename">/usr/local</code>, and
<code class="filename">/usr/share/doc</code>.
</p></dd><dt><span class="term"><code class="filename">/usr/bin</code>
</span></dt><dd><p>
Contains generally accessible programs.
</p></dd><dt><span class="term"><code class="filename">/usr/sbin</code>
</span></dt><dd><p>
Contains system daemons and programs reserved for the system
administrator that are not essential for booting the system.
</p></dd><dt><span class="term"><code class="filename">/usr/local</code>
</span></dt><dd><p>
In this directory the system administrator can install local,
distribution-independent extensions.
</p></dd><dt><span class="term"><code class="filename">/usr/share/doc</code>
</span></dt><dd><p>
Holds various documentation files and the release notes for your
system. In the <code class="filename">manual</code> subdirectory find an online
version of this manual. If more than one language is installed, this
directory may contain versions of the manuals for different languages.
</p><p>
Under <code class="filename">packages</code> find the documentation included in
the software packages installed on your system. For every package, a
subdirectory
<code class="filename">/usr/share/doc/packages/<em class="replaceable"><code>packagename</code></em></code>
is created that often holds README files for the package and sometimes
examples, configuration files or additional scripts.
</p><p>
If HOWTOs are installed on your system
<code class="filename">/usr/share/doc</code> also holds the
<code class="filename">howto</code> subdirectory in which to find additional
documentation on many tasks related to the setup and operation of Linux
software.
</p></dd><dt><span class="term"><code class="filename">/var</code><a class="indexterm" name="id357621"></a>
</span></dt><dd><p>
Whereas <code class="filename">/usr</code> holds static, read-only data,
<code class="filename">/var</code> is for data which is written during system
operation and thus is variable data, such as log files or spooling
data. For an overview of the most important log files you can find
under <code class="filename">/var/log/</code>, refer to
<a class="xref" href="cha.trouble.html#tab.trouble.info" title="Table 9.1. Log Files">Table 9.1, “Log Files”</a>.
</p></dd><dt><span class="term"><code class="filename">/windows</code><a class="indexterm" name="id357666"></a>
</span></dt><dd><p>
Only available if you have both Microsoft Windows and Linux installed
on your system. Contains the Windows data available on the Windows
partition of your system. Whether you can edit the data in this
directory depends on the file system your Windows partition uses. If it
is FAT32, you can open and edit the files in this directory. For NTFS,
openSUSE also includes write access support. However, the driver
for the NTFS-3g file system has limited functionality.
<span>Learn more in
Section “Accessing Files on Different OS on the Same Computer” (Chapter 34, <i>Copying and Sharing Files</i>, ↑Reference)</span>.
</p></dd></dl></div></div></div><div class="sect1" title="6.3. File Access Permissions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.new.users.accperm"></a>6.3. File Access Permissions<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.new.users.accperm">¶</a></span></h2></div></div></div><a class="indexterm" name="id357726"></a><a class="indexterm" name="id357734"></a><p>
In Linux, objects such as files or folders or processes generally belong
to the user who created or initiated them. There are some exceptions to
this rule. For more information about the exceptions, refer to
Chapter <i>Access Control Lists in Linux</i> (↑Security Guide). The group which is associated with a
file or a folder depends on the primary group the user belongs to when
creating the object.
</p><p>
When you create a new file or directory, initial access permissions for
this object are set according to a predefined scheme. As an owner of a
file or directory, you can change the access permissions for this object.
For example, you can protect files holding sensitive data against read
access by other users and you can authorize the members of your group or
other users to write, read, or execute several of your files where
appropriate. As <code class="systemitem">root</code>, you can also change the ownership of files or
folders.
</p><div class="sect2" title="6.3.1. Permissions for User, Group and Others"><div class="titlepage"><div><div><h3 class="title"><a name="sec.new.users.accperm.ugo"></a>6.3.1. Permissions for User, Group and Others<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.new.users.accperm.ugo">¶</a></span></h3></div></div></div><a class="indexterm" name="id357778"></a><a class="indexterm" name="id357787"></a><a class="indexterm" name="id357795"></a><p>
Three permission sets are defined for each file object on a Linux system.
These sets include the read, write, and execute permissions for each of
three types of users—the owner, the group, and other users. You can
view and change the access permissions of a file or folder in the file
managers of your desktop
or in a shell (see <a class="xref" href="cha.new.bash.html#sec.new.bash.perm" title="7.5. Modifying File Permissions">Section 7.5, “Modifying File Permissions”</a>).
</p><div class="figure"><a name="fig.new.users.konqui.rwx"></a><p class="title"><b>Figure 6.4. File Access Permissions in KDE File Manager</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#fig.new.users.konqui.rwx">¶</a></span></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0" width="70%"><tr><td><img src="images/kde_dolphin_accperm.png" width="100%" alt="File Access Permissions in KDE File Manager"></td></tr></table></div></div></div><br class="figure-break"><p>
The following example shows the output of an <span class="command"><strong>ls
<code class="option">-l</code></strong></span> command in a shell. This command lists the
contents of a directory and shows the details for each file and folder in
that directory.
</p><div class="example"><a name="ex.new.users.accperm.ugo"></a><p class="title"><b>Example 6.1. Access Permissions For Files and Folders</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#ex.new.users.accperm.ugo">¶</a></span></p><div class="example-contents"><pre class="screen">-rw-r----- 1 tux users 0 2006-06-23 16:08 checklist.txt
-rw-r--r-- 1 tux users 53279 2006-06-21 13:16 gnome_quick.xml
-rw-rw---- 1 tux users 0 2006-06-23 16:08 index.htm
-rw-r--r-- 1 tux users 70733 2006-06-21 09:35 kde-start.xml
-rw-r--r-- 1 tux users 47896 2006-06-21 09:46 kde_quick.xml
drwxr-xr-x 2 tux users 48 2006-06-23 16:09 local
-r-xr-xr-x 1 tux users 624398 2006-06-23 15:43 tux.jpg</pre></div></div><br class="example-break"><p>
As shown in the third column, all objects belong to user
<code class="systemitem">tux</code>. They are assigned to the
group <code class="filename">users</code> which is the primary group the user
<code class="systemitem">tux</code> belongs to. To retrieve the access
permissions the first column of the list must be examined more closely.
Let's have a look at the file <code class="filename">kde-start.xml</code>:
</p><div class="informaltable"><table border="1"><colgroup><col><col><col><col></colgroup><tbody><tr><td>
<p>
Type
</p>
</td><td>
<p>
User Permissions
</p>
</td><td>
<p>
Group Permissions
</p>
</td><td>
<p>
Permissions for Others
</p>
</td></tr><tr><td>
<p>
<code class="literal">-</code>
</p>
</td><td>
<p>
<code class="literal">rw-</code>
</p>
</td><td>
<p>
<code class="literal">r--</code>
</p>
</td><td>
<p>
<code class="literal">r--</code>
</p>
</td></tr></tbody></table></div><p>
The first column of the list consists of one leading character followed
by nine characters grouped in three blocks. The leading character
indicates the file type of the object: in this case, the hyphen
(<code class="literal">–</code>) shows that
<code class="filename">kde-start.xml</code> is a file. If you find the character
<code class="literal">d</code> instead, this shows that the object is a directory,
like <code class="filename">local</code> in
<a class="xref" href="cha.new.html#ex.new.users.accperm.ugo" title="Example 6.1. Access Permissions For Files and Folders">Example 6.1, “Access Permissions For Files and Folders”</a>.
</p><p>
The next three blocks show the access permissions for the owner, the
group and other users (from left to right). Each block follows the same
pattern: the first position shows read permissions
(<code class="literal">r</code>), the next position shows write permissions
(<code class="literal">w</code>), the last one shows execute permission
(<code class="literal">x</code>). A lack of either permission is indicated by
<code class="literal">-</code>. In our example, the owner of
<code class="filename">kde-start.xml</code> has read and write access to the file
but cannot execute it. The <code class="systemitem">users</code> group can read
the file but cannot write or execute it. The same holds true for the
other users as shown in the third block of characters.
</p></div><div class="sect2" title="6.3.2. Files and Folders"><div class="titlepage"><div><div><h3 class="title"><a name="sec.new.users.accperm.impact"></a>6.3.2. Files and Folders<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.new.users.accperm.impact">¶</a></span></h3></div></div></div><a class="indexterm" name="id358071"></a><a class="indexterm" name="id358079"></a><a class="indexterm" name="id358088"></a><a class="indexterm" name="id358096"></a><p>
Access permissions have a slightly different impact depending on the type
of object they apply to: file or directory. The following table shows the
details:
</p><div class="table"><a name="tab.new.users.accperm.impact"></a><p class="title"><b>Table 6.2. Access Permissions For Files And Directories</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#tab.new.users.accperm.impact">¶</a></span></p><div class="table-contents"><table summary="Access Permissions For Files And Directories" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>
<p>
Access Permission
</p>
</th><th>
<p>
File
</p>
</th><th>
<p>
Folder
</p>
</th></tr></thead><tbody><tr><td>
<p>
Read (r)
</p>
</td><td>
<p>
Users can open and read the file.
</p>
</td><td>
<p>
Users can view the contents of the directory. Without this
permission, users cannot list the contents of this directory with
<span class="command"><strong>ls <code class="option">-l</code></strong></span>, for example. However, if
they only have execute permission for the directory, they can
nevertheless access certain files in this directory if they know of
their existence.
</p>
</td></tr><tr><td>
<p>
Write (w)
</p>
</td><td>
<p>
Users can change the file: They can add or drop data and can even
delete the contents of the file. However, this does not include the
permission to remove the file completely from the directory as long
as they do not have write permissions for the directory where the
file is located.
</p>
</td><td>
<p>
Users can create, rename or delete files in the directory.
</p>
</td></tr><tr><td>
<p>
Execute (x)
</p>
</td><td>
<p>
Users can execute the file. This permission is only relevant for
files like programs or shell scripts, not for text files. If the
operating system can execute the file directly, users do not need
read permission to execute the file. However, if the file must me
interpreted like a shell script or a perl program, additional read
permission is needed.
</p>
</td><td>
<p>
Users can change into the directory and execute files there. If they
do not have read access to that directory they cannot list the files
but can access them nevertheless if they know of their existence.
</p>
</td></tr></tbody></table></div></div><br class="table-break"><p>
Note that access to a certain file is always dependent on the correct
combination of access permissions for the file itself
<span class="emphasis"><em>and</em></span> the directory it is located in.
</p></div></div></div><div class="navfooter"><table width="100%" summary="Navigation footer" border="0" class="bctable"><tr><td width="80%"><div class="breadcrumbs"><p><a href="index.html"> Documentation</a><span class="breadcrumbs-sep"> > </span><a href="book.opensuse.startup.html">Start-Up</a><span class="breadcrumbs-sep"> > </span><a href="part.basics.html">Basics</a><span class="breadcrumbs-sep"> > </span><strong><a accesskey="p" title="Part II. Basics" href="part.basics.html"><span>◀</span></a> <a accesskey="n" title="Chapter 7. Shell Basics" href="cha.new.bash.html"><span>▶</span></a></strong></p></div></td></tr></table></div></body></html>
ACC SHELL 2018