Linux+ Guide to Linux Certification, Third Edition

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.
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification, Second Edition
Linux Linux File System.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Linux File Security. What is Permission ? Specifies what right are granting to users to access the resources available in the computer. So that important.
Linux Commands LINUX COMMANDS.
Learning basic Unix command IT 325 operating system.
Guide To UNIX Using Linux Fourth Edition
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
Va-scanCopyright 2002, Marchany Unit 6 – Solaris File Security Randy Marchany VA Tech Computing Center.
The file structure and related utilities CS240 Computer Science II.
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.
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
Linux+ Guide to Linux Certification, Second Edition
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2011 by the Trustees of Indiana University except as noted.
Linux+ Guide to Linux Certification, Third 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.
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
Week 3 Exploring Linux Filesystems. Objectives  Understand and navigate the Linux directory structure using relative and absolute pathnames  Describe.
File Permission and Access. Module 6 File Permission and Access ♦ Introduction Linux is a multi-user system where users can assign different access permission.
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
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:
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter Two Exploring the UNIX File System and File Security.
Chapter 4: File Security & Permissions Also: Hard and Soft Links, see p77-80 &
Linux+ Guide to Linux Certification, Third Edition
Workbook 4 User & Group Permissions RH030 Linux Computing Essentials.
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2007 by the Trustees of Indiana University except as noted.
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
Chapter 8 File System Security. File Protection Schemes Login passwords Encryption File Access Privileges.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
CSCI 330 The UNIX System Unit V Permissions. all access to directories and files is controlled UNIX uses discretionary access control (DAC) model each.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
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.
Agenda The Linux File System (chapter 4 in text) Setting Access Permissions Directory vs File Permissions chmod Utility Symbolic Method Absolute Method.
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.
Jozef Goetz, expanded by Jozef Goetz, 2008 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
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.
ORAFACT The Linux File System. ORAFACT Filesystem Support Support for dozens of filesystem types including: Minix, ext2, MS-DOS, UMSDOS, VFAT, NTFS, NFS,
Linux Filesystem Management
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 file system "On a UNIX system, everything is a file;
Lecture 2 Working with Files and Directories
Chapter 8 File Security.
Exploring the UNIX File System and File Security
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Chapter Four UNIX File Processing.
The Linux Command Line Chapter 4
Module 6 Working with Files and Directories
Linux Commands LINUX COMMANDS.
January 26th, 2004 Class Meeting 2
The Linux Command Line Chapter 4
Presentation transcript:

Linux+ Guide to Linux Certification, Third Edition Chapter 4 Linux Filesystem Management

Objectives Find files and directories on the filesystem Understand and create linked files Explain the function of the Filesystem Hierarchy Standard Use standard Linux commands to manage files and directories Linux+ Guide to Linux Certification, 3e

Objectives (continued) Modify file and directory ownership Define and change Linux file and directory permissions Identify the default permissions created on files and directories Apply special file and directory permissions Linux+ Guide to Linux Certification, 3e

The Filesystem Hierarchy Standard Filesystem Hierarchy Standard (FHS): standard set of directories for Linux and UNIX systems Standard file and subdirectory contents Simplifies the task of finding specific files Gives Linux software developers ability to locate files on any Linux system Create non-distribution–specific software Linux+ Guide to Linux Certification, 3e

The Filesystem Hierarchy Standard (continued) Table 4-1: Linux directories defined by the Filesystem Hierarchy Standard Linux+ Guide to Linux Certification, 3e

The Filesystem Hierarchy Standard (continued) Table 4-1 (continued): Linux directories defined by the Filesystem Hierarchy Standard Linux+ Guide to Linux Certification, 3e

Managing Files and Directories mkdir command: creates new directories Arguments specify directory’s absolute or relative pathname mv command: moves files Minimum of two arguments: Source file/directory (may specify multiple sources) Target file/directory Pathnames can be absolute or relative For multiple files, can use wildcards in pathname Also used to rename files or directories Linux+ Guide to Linux Certification, 3e

Managing Files and Directories (continued) cp command: copies files Same arguments as the mv command Also used to make copies of files Recursive: referring to itself and its own contents Recursive copy command copies the directory and all subdirectories and contents Recursive search includes all subdirectories in a directory and their contents Use –r option Linux+ Guide to Linux Certification, 3e

Managing Files and Directories (continued) Interactive mode: Prompts user before overwriting files –i option –f option (force): Overrides interactive mode rm command: Removes files Arguments are a list of files Can use wildcards Interactive mode by default Use -f option to override Linux+ Guide to Linux Certification, 3e

Managing Files and Directories (continued) rmdir command: removes directories Arguments are a list of files Can use wildcards Interactive mode by default Use -f option to override Cannot be used to remove directory full of files To delete directory and all its contents (subdirectories and files), use rm –r command Linux+ Guide to Linux Certification, 3e

Managing Files and Directories (continued) Table 4-2: Common Linux file management commands Linux+ Guide to Linux Certification, 3e

Finding Files locate command: Search for files on system Receives full or partial filename as argument Uses premade indexed database of all files on system To update the database use updatedb command Information returned may not fit on screen Use with more or less commands Linux+ Guide to Linux Certification, 3e

Finding Files (continued) find command: recursively search for files starting from a specified directory Slower than locate command, but more versatile Format: find <start directory> -criteria <what to find> e.g., find /root –name project If using wildcard metacharacters, ensure that they are interpreted by the find command Place wildcards in quotation marks To reduce search time, specify subdirectory to be searched Linux+ Guide to Linux Certification, 3e

Finding Files (continued) Table 4-3: Common criteria used with the find command Linux+ Guide to Linux Certification, 3e

Finding Files (continued) Table 4-3 (continued): Common criteria used with the find command Linux+ Guide to Linux Certification, 3e

Finding Files (continued) PATH variable: lists directories on system where executable files are located Allows executable files to be run without specifying absolute or relative path which command: search for an executable file Searches the PATH variable If the file is not found, lists the directories that were searched Linux+ Guide to Linux Certification, 3e

Linking Files Symbolic link: one file is a pointer or shortcut to another Hard link: two files share the same data Linux+ Guide to Linux Certification, 3e

Linking Files (continued) Filesystem has three main structural sections: Superblock: Contains general information about the filesystem e.g., number of inodes and data blocks, size of each data block The inode table: consists of several inodes, each of which describes a file or directory Unique inode number, file size, data block locations, last date modified, permissions, and ownership Data blocks: Data making up contents of a file Linux+ Guide to Linux Certification, 3e

Linking Files (continued) Hard linked files share the same inode and inode number Must reside on the same filesystem To remove hard linked files, delete one of the linked files Reduces the link count for the file Linux+ Guide to Linux Certification, 3e

Linking Files (continued) Figure 4-1: The structure of hard linked files Linux+ Guide to Linux Certification, 3e

Linking Files (continued) Symbolic linked files do not share the same inode and inode number with their target file Symbolic linked file is a pointer to the target file Data blocks in the linked file contain only a pathname for the target file Linked file and target file have different sizes Editing symbolic linked file actually edits the target file If the target file is deleted, symbolic link serves no function Linux+ Guide to Linux Certification, 3e

Linking Files (continued) Figure 4-2: The structure of symbolically linked files Linux+ Guide to Linux Certification, 3e

Linking Files (continued) ln (link) command: Create hard and symbolic links Two arguments: Existing file to link Target file to create as a link to existing file Use –s option to create symbolic link Arguments can be relative or absolute pathnames Linux+ Guide to Linux Certification, 3e

File and Directory Permissions All users must login with a username and password Users identified by username and group memberships Access to resources depends on username and group membership Must have required permissions Linux+ Guide to Linux Certification, 3e

File and Directory Ownership Primary group: user’s default group During file creation, file’s owner and group owner set to user’s username and primary group Same for directory creation whoami command: view current user name groups command: view group memberships and primary group touch command: create an empty file Linux+ Guide to Linux Certification, 3e

File and Directory Ownership (continued) chown (change owner) command: change ownership of a file or directory Two arguments: New owner File to change Can use –R option for contents of directory chgrp (change group) command: change group owner of a file or directory Same arguments and options as for chown command Linux+ Guide to Linux Certification, 3e

Managing File and Directory Permissions Mode: inode section that stores permissions Three sections, based on the user(s) that receive the permission: User permissions: owner Group permissions: group owner Other permissions: everyone on system Three regular permissions may be assigned to each user: Read Write Execute Linux+ Guide to Linux Certification, 3e

Interpreting the Mode Figure 4-3: The structure of a mode Linux+ Guide to Linux Certification, 3e

Interpreting the Mode (continued) User: refers to owner of a file or directory Owner: refers to users with ability to change permissions on a file or directory Other: refers to all users on system Permissions are not additive Linux+ Guide to Linux Certification, 3e

Interpreting Permissions Table 4-4: Linux permissions Linux+ Guide to Linux Certification, 3e

Changing Permissions chmod (change mode) command: change mode (permissions) of files or directories Two arguments at minimum Criteria used to change permissions Filenames to change Permissions stored in a file’s or a directory’s inode as binary powers of two Linux+ Guide to Linux Certification, 3e

Changing Permissions (continued) Table 4-5: Criteria used within the chmod command Linux+ Guide to Linux Certification, 3e

Changing Permissions (continued) Figure 4-4: Numeric representation of the mode Linux+ Guide to Linux Certification, 3e

Changing Permissions (continued) Table 4-6: Numeric representations of the permissions in a mode Linux+ Guide to Linux Certification, 3e

Default Permissions New files given rw-rw-rw- permissions by default umask: takes away permissions on new files and directories umask command: displays the umask Changing the umask Use a new umask as an argument to the umask command Linux+ Guide to Linux Certification, 3e

Default Permissions (continued) Figure 4-5: Performing a umask 022 calculation Linux+ Guide to Linux Certification, 3e

Default Permissions (continued) Figure 4-6: Performing a umask 007 calculation Linux+ Guide to Linux Certification, 3e

Special Permissions Three more optional special permissions for files and directories SUID (Set User ID) SGID (Set Group ID) Sticky bit Linux+ Guide to Linux Certification, 3e

Defining Special Permissions SUID If set on a file, user who executes the file becomes owner of the file during execution e.g., ping command No functionality when set on a directory Only applicable to binary compiled programs Cannot be used on shell scripts Linux+ Guide to Linux Certification, 3e

Defining Special Permissions (continued) SGID Applicable to files and directories If set on a file, user who executes the file becomes member of the file’s group during execution If a user creates a file in a directory with SGID set, the file’s group owner is set to be the directory’s group owner and not the user’s primary group Linux+ Guide to Linux Certification, 3e

Defining Special Permissions (continued) Sticky bit Previously used to lock files in memory Currently only applicable to directories Ensures that a user can only delete his/her own files when given write permissions in a directory Linux+ Guide to Linux Certification, 3e

Setting Special Permissions Special permissions require execute Mask the execute permission when displayed by the ls –l command May be set even if file or directory does not have execute permission Indicating letter in the mode will be capitalized Add special permissions via chmod command Add an extra digit at front of permissions argument Linux+ Guide to Linux Certification, 3e

Setting Special Permissions (continued) Figure 4-7: Representing special permissions in the mode Linux+ Guide to Linux Certification, 3e

Setting Special Permissions (continued) Figure 4-8: Representing special permissions in the absence of the execute permissions Linux+ Guide to Linux Certification, 3e

Setting Special Permissions (continued) Figure 4-9: Numeric representation of regular and special permissions Linux+ Guide to Linux Certification, 3e

Summary The Linux directory tree obeys the FHS Allows system files to be located in standard directories Many file management commands exist Can find files using different commands locate: search preindexed database which: search PATH variable find: search for file based on criteria Linux+ Guide to Linux Certification, 3e

Summary (continued) Files can be created as pointers to another file or as a linked duplicate of another file Called symbolic and hard links, respectively Each file and directory has an owner and a group owner Owner can change permissions and grant ownership Permissions can be set on the owner of a file, members of the group of the file, and everyone on the system (other) Linux+ Guide to Linux Certification, 3e

Summary (continued) Three regular file and directory permissions (read, write, execute) and three special file and directory permissions (SUID, SGID, sticky bit) Permissions can be changed using chmod New files and directories receive default permissions from the system The root user has all permissions to all files and directories on the Linux filesystem Root user can change the ownership of any file or directory on the Linux filesystem Linux+ Guide to Linux Certification, 3e