Linux+ Unit 05

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Linux+ Unit 05 as PDF for free.

More details

  • Words: 1,191
  • Pages: 51
Course ILT

Linux filesystem management Unit objectives  Explain the function of the Filesystem Hierarchy Standard  Find files and directories and link files  Modify file and directory ownership  Identify the default permissions and apply special file and directory permissions

Course ILT

Topic A  Topic A: The Filesystem Hierarchy Standard  Topic B: Searching and linking files  Topic C: File and directory permissions  Topic D: Default and special permissions

Course ILT

Filesystem Hierarchy Standard  Outlines standard locations for files and directories  Gives software developers a consistent context regardless of the distribution  Helps users of one system work on another

Course ILT

Linux directories defined by FHS

Course ILT

FHS: Linux directories

Course ILT

Activity A-1

Discussing the FHS directory structure

Managing files and directories Course ILT

 mkdir command – Takes arguments specifying the absolute or relative pathnames of the directories to create

Course ILT

Activity A-2

Creating new directories

Course ILT

Managing files and directories  The mv command requires two arguments at a minimum: – Source file/directory – Target file/directory

continued

Managing files and directories, continued

Course ILT

 cp command – Command used to create copies of files and directories

continued

Managing files and directories, continued

Course ILT

 rm command – Takes a list of arguments specifying the absolute or relative pathname of files to remove

continued

Managing files and directories, continued

Course ILT

 rmdir command – Command used to empty directories

Course ILT

Activity A-3

Moving files by using the mv command

Course ILT

Activity A-4

Copying files by using the cp command

Course ILT

Activity A-5

Using the rm and rmdir commands

Course ILT

Topic B  Topic A: The Filesystem Hierarchy Standard  Topic B: Searching and linking files  Topic C: File and directory permissions  Topic D: Default and special permissions

Finding files Course ILT

 locate command – Fastest method to search for files – A shortcut to the slocate (or secure locate) command

 find command – Used to find files using various criteria – Searches the directory tree recursively, starting from a certain directory, for files that meet criteria

which command and PATH variable

Course ILT

 which command – Used to locate files within directories listed in the PATH variable

 PATH variable – Stores list of directories searched when commands are executed without an absolute or relative pathname

Course ILT

Activity B-1

Using find, locate, and which commands

Course ILT

Linking files  On a structural level, a filesystem has three main sections: – The superblock – The inode table – Data blocks

 Files can be linked two ways – Symbolic link or symlink, one file a pointer or a shortcut to another file – Hard link, two files share the same data

Course ILT

Structure of hard linked files

In command Course ILT

 ln (link) command – Command used to create hard and symbolic links

 To create hard link use the ln command with two arguments: – The existing file to hard-link – The target file that will be created as a hard link to the existing file

Course ILT

Structure of symbolically linked files

Course ILT

Activity B-2

Making and viewing links to files and directories

Course ILT

Topic C  Topic A: The Filesystem Hierarchy Standard  Topic B: Searching and linking files  Topic C: File and directory permissions  Topic D: Default and special permissions

Course ILT

File and directory permissions  When a user creates a file or directory, that user’s name and primary group become the owner and group owner of the file  Primary group – Default group to which a user belongs

chown and chgrp commands Course ILT

 chown (change owner) command – Used to change the owner and group owner of a file or directory

 chgrp (change group) command – Change the group owner of a file or directory – Takes two arguments at a minimum:  The new group owner  The files or directories to change

Course ILT

Activity C-1

Using chown and chgrp

Managing file and directory permissions

Course ILT

 Mode – The section of the inode that stores permissions – Divided into three sections based on the user(s) that receive(s) the permission to that file or directory  User (owner) permissions  Group (group owner) permissions  Other (everyone on the Linux system) permissions

Course ILT

Regular permissions  There are three regular permissions that you might assign to a user – Read – Write – Execute

Course ILT

The structure of a mode

Course ILT

Interpreting permissions

Course ILT

chmod command  Used to change the mode (permissions) of a file or directory  Takes two arguments at a minimum: – The first specifies criteria used to change permissions – The remaining arguments indicate the filenames to change

Course ILT

Criteria used: chmod command

Course ILT

Mode: numeric representation

Course ILT

Numeric representations: permissions

Course ILT

Activity C-2

Applying and modifying access permissions

Course ILT

Topic D  Topic A: The filesystem hierarchy standard  Topic B: Searching and linking  Topic C: File and directory permissions  Topic D: Default and special permissions

Default permissions Course ILT

 umask – Used to alter the permissions on all new files and directories – Takes select default file and directory permissions away – Applies only to newly created files and directories  Never used to modify existing files or directories

Course ILT

umask 022 calculation

Course ILT

umask 007 calculation

Course ILT

Activity D-1

Using the umask variable

Course ILT

Special permissions  Three special permissions that you can use on files and directories: – SUID (Set User ID) – SGID (Set Group ID) – Sticky bit

Course ILT

Defining special permissions  The SUID has no special function when set on a directory – However, if the SUID is set on a file and that file is executed, then the person who executed the file temporarily becomes the owner of the file while it is executing

 The SUID can be applied only to binary compiled programs

continued

Course ILT

Defining special permissions, continued

 The SGID has a function when applied to both files and directories  The SGID allows regular users to execute a binary compiled program and become a member of the group that is attached to the file during execution of the program  The sticky bit performs a useful function only on directories

Course ILT

Setting special permissions  The mode of a file that is displayed using the ls –l command does not have a section for special permissions  Special permissions require execute – They mask the execute permission when displayed using the ls –l command

Course ILT

Special permissions in the mode

Course ILT

Absence of execute permissions

Course ILT

Numeric representation

Course ILT

Activity D-2

Viewing and setting special permissions

Course ILT

Unit summary  Explained the function of the Filesystem Hierarchy Standard  Found files and directories and linked files  Modified file and directory ownership  Identified default permissions and applied special file and directory permissions

Related Documents

Linux+ Unit 05
November 2019 15
Linux+ Unit 11
November 2019 8
Linux+ Unit 14
November 2019 18
Linux+ Unit 15
November 2019 17
Linux+ Unit 01
November 2019 14
Linux+ Unit 02
October 2019 22