SYSTEMS
ADMINISTRATION &
MAINTENANCE CLASS
Lesson 8 – File Permissions
Permissions on Files
Denoted by a letter
A permission represents an action that
can be done on the file
Occasionally referred as permission bits
Note that for script you need both
Execute and Read permission
Permissions on Directories
r, w and x has also meaning for directories
The meanings for directories is slightly different
Read r – permission to get a listing of the directory
Write w – permission to create, delete, or rename
files within the directory
Execute x – permission to change to the directory,
or to use the directory as an intermediate part of
the path of a file.
Examining Permissions
The ls –l command allows you to look at the
permissions of a file.
Preserving Permissions
By default the cp command makes no
attempt to preserve permissions
 -p to preserve permissions and timepstamp
How Permissions apply
If you own a file, the per-owner permission
apply to you
Otherwise if you are in the group that owns
the file, the per-group permissions apply to
you
Listing Directory Contents
ls Compact listing on non-hidden files
ls -a Compact listing of ALL files
ls -l Detailed listing of non-hidden files
ls -F Displays symbols to mark directories
and executable files
ls -ld Detailed listing of specified directory
ls -i Displays i-node number
(I.d. number of files)
Access Permissions
 Limiting unauthorized access to your directories and files
is a very important concern for ALL Linux (Unix) users.
 Consequences of Unauthorized Access:
 Copying your assignments (cheating)
 Using your account for illegal activity
 Using your account to send obscene messages
 Tampering with files
File / Directory Permissions
 The Linux (Unix) OS can allow the user to specify read,
write and execute permissions to the user, group or all
others (UGO) for files.
 A user can also specify read, write and execute
permissions for a directory. The execute permission for a
directory allows the person to view files in that directory
chmod Command
(Relative Method)
Used to change the access permissions of a file or directory
Format:
chmod [option] [who] [operation] [permission] file
chmod [option] [permission] file-list
 who relates to user (u) , group (g) or all others (o)
 operation relates to adding (+), removing (-) or
setting (=) permissions
 permissions are read (r), write (w) and execute (x)
chmod Command
(Relative Method)
Examples:
 Add Permission
chmod g+rw file.name
chmod o+x file.name
 Remove Permission
chmod g-w file.name
chmod a-w file.name (removes write for ugo)
 Set Permission
chmod o=rx file.name
chmod go=rx filename
Note: you can
use wildcard
symbols (eg *) to
match particular
files
File Access Rights
 Types of Users:
 Owner
 Group
 All/Other
 Types of Permissions:
 Read
 Write
 Execute
 Types of Files
 Directories
 Other files
Table 8.1 Summary of File Permissions in LINUX
Directory Permissions
 read = list files in the directory
 write = add new files to the directory
 execute = access files in the directory
Determining File Access Rights
Table 8.2 Permission Values
Table 8.3 Permissions for Access to courses, labs, and temp
Changing the Access Rights
Purpose – to set/change permissions in files
 chmod [options] octal-mode filelist
 chmod [options] symbolic-mode filelist
Options
 -R recursively process subdirectories
Table 8.4 Values for Symbolic Mode Components
Table 8.5 Examples of the chmod Commands and Their Purposes
Table 8.5 Examples of the chmod Commands and Their Purposes

Systems administration & maintenance - File Permissions.pptx

  • 1.
  • 2.
    Permissions on Files Denotedby a letter A permission represents an action that can be done on the file Occasionally referred as permission bits Note that for script you need both Execute and Read permission
  • 3.
    Permissions on Directories r,w and x has also meaning for directories The meanings for directories is slightly different Read r – permission to get a listing of the directory Write w – permission to create, delete, or rename files within the directory Execute x – permission to change to the directory, or to use the directory as an intermediate part of the path of a file.
  • 4.
    Examining Permissions The ls–l command allows you to look at the permissions of a file.
  • 5.
    Preserving Permissions By defaultthe cp command makes no attempt to preserve permissions  -p to preserve permissions and timepstamp
  • 6.
    How Permissions apply Ifyou own a file, the per-owner permission apply to you Otherwise if you are in the group that owns the file, the per-group permissions apply to you
  • 7.
    Listing Directory Contents lsCompact listing on non-hidden files ls -a Compact listing of ALL files ls -l Detailed listing of non-hidden files ls -F Displays symbols to mark directories and executable files ls -ld Detailed listing of specified directory ls -i Displays i-node number (I.d. number of files)
  • 8.
    Access Permissions  Limitingunauthorized access to your directories and files is a very important concern for ALL Linux (Unix) users.  Consequences of Unauthorized Access:  Copying your assignments (cheating)  Using your account for illegal activity  Using your account to send obscene messages  Tampering with files
  • 9.
    File / DirectoryPermissions  The Linux (Unix) OS can allow the user to specify read, write and execute permissions to the user, group or all others (UGO) for files.  A user can also specify read, write and execute permissions for a directory. The execute permission for a directory allows the person to view files in that directory
  • 10.
    chmod Command (Relative Method) Usedto change the access permissions of a file or directory Format: chmod [option] [who] [operation] [permission] file chmod [option] [permission] file-list  who relates to user (u) , group (g) or all others (o)  operation relates to adding (+), removing (-) or setting (=) permissions  permissions are read (r), write (w) and execute (x)
  • 11.
    chmod Command (Relative Method) Examples: Add Permission chmod g+rw file.name chmod o+x file.name  Remove Permission chmod g-w file.name chmod a-w file.name (removes write for ugo)  Set Permission chmod o=rx file.name chmod go=rx filename Note: you can use wildcard symbols (eg *) to match particular files
  • 12.
    File Access Rights Types of Users:  Owner  Group  All/Other  Types of Permissions:  Read  Write  Execute  Types of Files  Directories  Other files
  • 13.
    Table 8.1 Summaryof File Permissions in LINUX
  • 14.
    Directory Permissions  read= list files in the directory  write = add new files to the directory  execute = access files in the directory
  • 15.
  • 16.
  • 17.
    Table 8.3 Permissionsfor Access to courses, labs, and temp
  • 18.
    Changing the AccessRights Purpose – to set/change permissions in files  chmod [options] octal-mode filelist  chmod [options] symbolic-mode filelist Options  -R recursively process subdirectories
  • 19.
    Table 8.4 Valuesfor Symbolic Mode Components
  • 20.
    Table 8.5 Examplesof the chmod Commands and Their Purposes
  • 21.
    Table 8.5 Examplesof the chmod Commands and Their Purposes

Editor's Notes

  • #1 NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image.