Chapter Two Exploring the UNIX File System and File Security.

Slides:



Advertisements
Similar presentations
A Guide to Unix Using Linux Fourth Edition
Advertisements

Pre-Assessment Questions
5 Basic utilities When a user logs in to the Linux operating system the directory that they will start in is their home directory. Most users will have.
Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
GNU/Linux Filesystem 1 st AUT GNU/Linux Festival Computer Engineering & IT Department Bahador Bakhshi.
Linux+ Guide to Linux Certification, Second Edition
Chapter 5 Accessing Files and Directories. How Directories Get Created OS installation: usr, dev, etc, export, kernel and others places to store installation.
Linux Linux File System.
The UNIX File System.
Guide To UNIX Using Linux Third Edition
File Management System The way a user or application may access files Programmer does not need to develop file management software You take files for granted.
UNIX Files and Security Software Tools. Slide 2 File Systems l What is a file system? A means of organizing information on the computer. A file system.
Basic UNIX © McGraw Hill All rights reserved.
File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.
Learning basic Unix command IT 325 operating system.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Guide To UNIX Using Linux Fourth Edition
Notes Assignment #1 is due next Friday by 11:59 pm via Test #1 will be held Thursday February 18 at the start of class (one period long) Format:
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Manage Directories and Files in Linux
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Unix Basics Chapter 4.
Linux+ Guide to Linux Certification, Second Edition
Chapter Two Exploring the UNIX File System and File Security.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
Managing Files. Module 5 Managing Files ♦ Introduction “On a Linux system, everything is a file; if something is not a file, it is a process.” ♦ Topics.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
Manage Directories and Files in Linux. 2 Objectives Understand the Filesystem Hierarchy Standard (FHS) Identify File Types in the Linux System Change.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Linux Commands C151 Multi-User Operating Systems.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Agenda The Linux File System (chapter 4 in text)
BIF713 File and Directory Management. File System A File System is a structure used to organize programs and data on a computer ’ s storage device Files.
SUSE Linux Enterprise Desktop Administration Chapter 7 Manage Directories and Files.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
The Unix File System R Bigelow. The UNIX File System The file system refers to the way in which UNIX implements files and directories. The UNIX file system.
Learning basic Unix command It 325 operating system.
Chapter 2: Exploring the UNIX File System (For Tuesday Section) File and File Systems.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Agenda The Linux File System (chapter 4 in text) Directory Structures / Navigation Terminology File Naming Rules Relative vs Absolute pathnames Unix Commands:
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II FILES AND FILE SYSTEM STRUCTURE.
Linux Filesystem Management
Agenda The Linux File System (chapter 4 in text)
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Linux 101 Training Module Linux Basics.
Linux file system "On a UNIX system, everything is a file;
Chapter 6 File Systems CSNB113 SYSTEM ADMINISTRATION
Lecture 2 Working with Files and Directories
C151 Multi-User Operating Systems
9 Linux on the Desktop.
Exploring the UNIX File System and File Security
Introduction Paul Flynn
Chapter 4: The Linux Filesystem
January 26th, 2004 Class Meeting 2
Presentation transcript:

Chapter Two Exploring the UNIX File System and File Security

2 Lesson A Understanding Files and Directories

3 Objectives Discuss and explain the UNIX file system Define a UNIX file system partition Use the mount command to mount a file system

4 Objectives (cont.) Discuss relative and absolute path addressing Diagram the UNIX file system hierarchy Navigate the file system

5 Understanding the UNIX File System A file is the basic component for data storage –UNIX considers everything it interacts with a file A file system is UNIX’s way of organizing files on mass storage (disk) 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 similar to an inverted tree

6

7 Understanding the Standard Tree Structure 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 (/) A directory is a file that can contain other files and directories A subdirectory is a directory within a directory –The subdirectory is considered the child of the parent directory

8 Using UNIX Partitions The section of the disk that holds a file system is called a partition –When installing UNIX, one of the first tasks is deciding how to partition a storage device, or hard disk –Hard disks may have many partitions UNIX partitions are given names –LINUX uses hda1 and hda2

9 Using UNIX Partitions Storage devices are called peripheral devices Peripheral devices connect to the computer through electronic interfaces –IDE - Integrated Drive Electronics –SCSI - Small Computer System Interface

10

11 Exploring the Root File System UNIX 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

12 Exploring the Root File System 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

13

14 Exploring the Root File System 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

15 Exploring the Root File System (2) 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

16 Using the Mount Command Users can access mounted file systems which they have permission to access. By default, ordinary users will NOT have this privilege. 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

17 Understanding Paths and Pathnames 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 command prompt may indicate your location within the file system –Use the UNIX pwd command to display the current path name

18

19 Navigating the File System To navigate the UNIX directory structure, use the cd (change directory) command UNIX refers to a path as either: –Absolute - begins at the root level and lists all subdirectories to the destination file Ex. /usrs/jdoe/file1 (An absolute reference will ALWAYS begin with a /.) –Relative - begins at your current working directory and proceeds from there Ex. 1 file1 (file1 is located within the current directory) Ex. 2 sub1/file1 (file1 is located within the sub1 directory immediately beneath your current working directory) A relative reference will NEVER begin with a /.

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

21 Listing Directory Contents The system normally uses hidden files to keep configuration information and for other purposes

22 Lesson B Working with Files, Directories, and Security

23 Objectives Create new directories to store files Copy files from one directory to another Set file permissions for other user access to directory and files

24 Managing Directories and Files mkdir (make directory) command –Create a new directory rmdir (make directory) command –Delete an empty directory cp (copy) command –Copy files from one director to another rm (remove) command –Delete files

25 Files & Subdirectories (2) pwd – displays your current location in the file system ie. Your working directory mkdir sub1 – creates a subdirectory within your current working directory. For example, if you are currently in the directory /root/users/marty, you will now have a subdirectory named sub1 immediately beneath marty.

26 File and Subdirectory Practice Your working directory is jsmith. 1. Create a file named file1 in the current directory. –cat >file1 or touch file1 2. Change your directory to ‘dir1’. –cd dir1 3. Create a subdirectory ‘newdir’ immediately beneath ‘dir2’. –mkdir dir2/newdir Since you are currently in dir1, you must specify the directory path from dir1 to dir2 so that you can create newdir beneath dir2 4. Create a file named file2 in the subdirectory ‘newdir’ without changing your current location. (You are in dir1) –cat >dir2/newdir/file2 or touch dir2/newdir/file2 5. Display the contents of the file ‘file1’ located in the ‘jsmith’ subdirectory without changing your working directory. (You are in dir1) –cat../file1

27 6. Display the names of the files in the subdirectory ‘dir2’ without changing your current location. (You are in dir1). –ls dir2 7. Change your working directory to root (/). –cd / 8. Change your working directory to your home directory. –cd 9. Display the contents of the file ‘file2’ from your current directory. (file2 is found in ‘newdir’ – you created it in #4, you are in jsmith). –cat dir1/dir2/newdir/file2 10. You are in newdir (subordinate to dir2). Display the contents of ‘file4’ in jsmith without changing your current directory. Use a relative file name. –cat../../../file4 File and Subdirectory Practice (2)

28 Managing Files and Directories Practice Exercises Click on the following link to review the practice exercises on managing files and directories. File and Directory Practice Exercises (If you have a Pop-Up Stopper enabled, you will have to disable it to view the exercise above.)

29 Setting File Permissions So we see that X11and cron.daily are subdirectories and adjtime is a normal file.

30 Setting File Permissions File Permissions rOwner has read wOwner has write xOwner has execute rGroup has read -Group does not have write xGroup has execute rOthers have read -Others do not have write xOthers have execute The ls –l command displays the file permissions. The first character specifies the file type, the next 3 chars specify the file owner’s permissions, the following 3 chars represent the permissions that the group associated with the file will have, and the final 3 chars specify the permissions that all other users on the system will have for this file.

31 File Permissions (2) In UNIX, each file has an owner (typically the user that created the file), and a group. Note that a file may have any combination of the following rights (read, write, execute) for either owner, group, or other (everyone else). If the file ‘junk’ has the following permissions: -rwxr-xr— –It is a normal file (1 st char is a -) –Owner has read, write, and execute –Group has read and execute –All other users have only read

32 Setting File Permissions for Security chmod command –To set file permissions –Settings are read (r), write (w), execute (x) –The three types of users are owners, groups, and others Setting permissions to directories –Use the execute (x) to grant access

33 File Permissions Categories In UNIX, each file has an owner and a primary group associated with it. Typically, the owner is the user who created the file and the primary group associated with that owner is the group associated with the file. The owner, group and the ‘rest of the world’ can each have r,w, or x to the file.

34 File Permissions Meanings Read (r) –Having the r right to a file enables the user to cat the contents of the file. –Having the r right to a directory enables the user to ls the contents of the directory. Write (w) –Having the w right to a file enables the user to change, delete or modify the file. –Having the w right to a directory enables the user to add, rename, or delete files and/or subdirectories to the directory. Execute (x) –Having the x right to a file enables the user to execute the file (typically used for script files) –Having the x right to a directory enables the user to make the directory his or her current working directory.

35 The chmod command The chmod command is used to set file permissions. Experienced UNIX users use a numeric command to exactly specify all rights at once. Each permission is assigned a numeric value (r=4,w=2,x=1) and the values are added together to represent each category’s (owner, group, world) cumulative rights. –For example, the permission set of –rwxrw-r– would be assigned a numeric value of 764 [owner rwx (4+2+1=7); group rw (4 + 2=6); and world r (4) –So by issuing the command ‘chmod 764 file1’, you would grant file1’s owner rwx, file1’s group rw and the world r to the file.

36 Chmod practice To assign the owner rw, the group r and the world no rights, –chmod 640 file1 To assign the owner rwx, the group rw, and the world no rights, –chmod 760 file1 To assign the owner rwx, the group no rights, and the world no rights, –chmod 700 file1

37 Chapter Summary In UNIX, a file is the basic component for data storage and UNIX considers everything a file A file system is the UNIX system’s way of organizing files on mass storage devices and each file is referenced using a correct and unique pathname The standard tree structure starts with the root (/) directory The section of the mass storage device (or disk) that holds a file system is a partition

38 Chapter Summary (2) A path serves as as a map to access any file on the system You may customize your command prompt to display the current working directory name, the current date and time, and several other items The ls command displays the names of files and directories contained in a directory Wildcard characters (i.e. *, ?) can be used in a command such as ls and take the place of other characters in a file name

39 Chapter Summary (3) Use the mkdir command to create a new directory, as long as you own the parent Use the chmod command to set permissions such as read (r), write (w), execute (x) for files that you own Use the cp command to copy a source file to a destination file and directory

40

41