29
Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides) 1 CTEC 110

Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

Embed Size (px)

Citation preview

Page 1: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

Chapter Two

Exploring the UNIX/Linux File Systems and File Security

Guide To UNIX Using Linux Fourth EditionChapter 2 Unix (31 slides) 1CTEC 110

Page 2: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• Discuss UNIX/Linux file systems• Explain partitions and inodes• Understand the elements of the root hierarchy• Use the mount command• Explain and use paths, pathnames, and prompts• Navigate the file system• Create and remove directories• Copy and delete files• Configure file permissions

Objectives

Chapter 2 Unix (31 slides) 2CTEC 110

Page 3: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• File: basic component for data storage– UNIX/Linux considers everything to be a file

• A file system is UNIX/Linux’s way of organizing files on mass storage devices– A physical file system is a section of the hard

disk that has been formatted to hold files• The file system is organized in a hierarchical

structure (inverted tree)

Understanding UNIX/LinuxFile Systems

Chapter 2 Unix (31 slides) 3CTEC 110

Page 4: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

Understanding UNIX/LinuxFile Systems (continued)

Chapter 2 Unix (31 slides) 4CTEC 110

Page 5: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• The structure starts at the root level– Root is the name of the file at this basic level

and it is denoted by the slash character (/)• Directory: file that can contain other files and

directories• Subdirectory: directory within a directory

– The subdirectory is considered the child of the parent directory

Understanding the Standard Tree Structure

Chapter 2 Unix (31 slides) 5CTEC 110

Page 6: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• The section of the disk that holds a file system is called a partition– When installing UNIX/Linux, one of the first

tasks is deciding how to partition a storage device, or hard disk

– Hard disks may have many partitions• UNIX/Linux partitions are given names

– LINUX uses hda1 and hda2

Using UNIX/Linux Partitions

Chapter 2 Unix (31 slides) 6CTEC 110

Page 7: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• Storage devices are called peripheral devices• Peripheral devices connect to the computer

through electronic interfaces– IDE: Integrated Drive Electronics– SCSI: Small Computer System Interface

Using UNIX/Linux Partitions (continued)

Chapter 2 Unix (31 slides) 7CTEC 110

Page 8: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

Chapter 2 Unix (31 slides) 8CTEC 110

Page 9: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• Partitioning your hard disk provides organized space for file systems

• At least 3 partitions (root, swap, /boot) often recommended

• Root partition holds root file system directory (/), size depends on installation but often ranges between 1.2 to 5+ GB

Setting Up Hard Disk Partitions

Chapter 2 Unix (31 slides) 9CTEC 110

Page 10: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• Swap partition acts as a memory extension, often has same size as RAM, enables virtual memory

• /boot partition used to store the os files comprising the kernel and is relatively small

• Other used partitions include /usr, /home, /var

Setting Up Hard Disk Partitions (continued)

Chapter 2 Unix (31 slides) 10CTEC 110

Page 11: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• Inodes are associated with directories and files in ufs and ext file systems

• An inode contains the name, general information, and location information (a pointer) for a file or directory

• A superblock contains information about the block layout on a specific partition

Using Inodes

Chapter 2 Unix (31 slides) 11CTEC 110

Page 12: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• UNIX/Linux must mount a file system before any programs can access files on it

• To mount a file system is to connect it to the directory tree structure

• The root file system is mounted by the kernel when

the system starts

Exploring the Root Hierarchy

Chapter 2 Unix (31 slides) 12CTEC 110

Page 13: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• The root directory contains sub-directories that contain files:– /bin contains binaries, or executables needed to

start the system and perform system tasks– /boot contains files needed by the bootstrap

loader as well as kernel images– /dev contains system device reference files

Exploring the Root Hierarchy (continued)

Chapter 2 Unix (31 slides) 13CTEC 110

Page 14: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

Chapter 2 Unix (31 slides) 14CTEC 110

Page 15: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• Root subdirectories continued:– /etc contains configuration files that the system

uses when the computer starts– /lib contains kernel modules, security information,

and the shared library images– /mnt contains mount points for temporary mounts

by the system administrator– /proc is a virtual file system allocated in memory

only

Exploring the Root Hierarchy (continued)

Chapter 2 Unix (31 slides) 15CTEC 110

Page 16: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• Root subdirectories continued:– /root is the home directory of the root user, or the

system administrator– /sbin contains essential network programs used

only by the system administrator – /tmp is a temporary place to store data during

processing cycles– /var contains subdirectories which have sizes that

often change, such as error logs

Exploring the Root Hierarchy (continued)

Chapter 2 Unix (31 slides) 16CTEC 110

Page 17: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• Users can access mounted file systems which they have permission to access

• Additional file systems can be mounted at any time using the mount command

• To ensure system security, only the root user uses

the mount command

Using the mount Command

Chapter 2 Unix (31 slides) 17CTEC 110

Page 18: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• To specify a file or directory, use its pathname, which follows the branches of the file system to the desired file– A forward slash (/) separates each directory

name– The UNIX/Linux command prompt may indicate

your location within the file system– Use the UNIX/Linux pwd command to display

the current path name

Using Paths, Pathnames, and Prompts

Chapter 2 Unix (31 slides) 18CTEC 110

Page 19: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

Chapter 2 Unix (31 slides) 19CTEC 110

Page 20: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

Chapter 2 Unix (31 slides) 20CTEC 110

Page 21: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• To navigate the UNIX/Linux directory structure, use the cd (change directory) command

• UNIX/Linux refers to a path as either:– Absolute - begins at the root level and lists all

subdirectories to the destination file– Relative - begins at your current working

directory and proceeds from there

Navigating the File System

Chapter 2 Unix (31 slides) 21CTEC 110

Page 22: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• UNIX/Linux interpret a single dot (.) to mean the current working directory

• Two dots (..) mean the parent directory• cd .. moves you up a level in the directory structure

Using Dot and Dot Dot Addressing Techniques

Chapter 2 Unix (31 slides) 22CTEC 110

Page 23: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

The ls (list) command displays a directory’s contents, including files and subdirectories

Listing Directory Contents

Chapter 2 Unix (31 slides) 23CTEC 110

Page 24: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• A wildcard is a special character that is used as a placeholder

• The * wildcard represents any group of characters in a file name

• The ? wildcard represents a single character in a file name

Using Wildcards

Chapter 2 Unix (31 slides) 24CTEC 110

Page 25: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• mkdir (make directory) command– Create a new directory

• rmdir (remove directory) command– Delete an empty directory

• cp (copy) command– Copy files from one directory to another

• rm (remove) command– Delete files

Creating and Removing Directories and Files

Chapter 2 Unix (31 slides) 25CTEC 110

Page 26: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

Configuring File Permissions for Security

Chapter 2 Unix (31 slides) 26CTEC 110

Page 27: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

Configuring File Permissions for Security (continued)

File Permissionsr Owner has read

w Owner has write

x Owner has execute

r Group has read

- Group does not have write

x Group has execute

r Others have read

- Others do not have write

x Others have execute

Chapter 2 Unix (31 slides) 27CTEC 110

Page 28: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• chmod command– To set file permissions– Settings are read (r), write (w), execute (x)– The three types of users are owners(users),

groups, and others(world) or simply (ugo)• Setting permissions to directories

– Use the execute (x) to grant access

Configuring File Permissions for Security (continued)

Chapter 2 Unix (31 slides) 28CTEC 110

Page 29: Chapter Two Exploring the UNIX/Linux File Systems and File Security Guide To UNIX Using Linux Fourth Edition Chapter 2 Unix (31 slides)1 CTEC 110

• Work through Hands-on Projects at end of chapter 2

• Canvas: Review Questions 2– (Do not do questions 22,23,24 and 25)

• Read chapter 3 before next class session

• Quiz 2 Unix…

Chapter 2 Unix Exercises

Chapter 2 Unix (31 slides) 31CTEC 110