Unix Access Privileges - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Unix Access Privileges

Description:

rw-rw-rw- 1 nobody 382 Nov 18 1998 old.profile -rw- 1 jdoe 652 Jul 12 12:16 old.xsession ... rw-rw-rw- 1 nobody wheel 382 Nov 18 1998 old.profile ... – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 19
Provided by: jimdab
Category:

less

Transcript and Presenter's Notes

Title: Unix Access Privileges


1
Unix Access Privileges
  • Chapter 5.1-5.2

2
Access privileges
  • All UNIX files have privileges associated with
    them
  • These privileges determine who can access the
    file
  • These privileges determine how people can access
    the file

3
Viewing access privileges
  • Use the ls -l command

drwx------ 2 jdoe 8192 Jul 12 1226
nsmail/ -rw-r--r-- 1 jdoe 945 Mar 15 1601
old.cshrc -rwxrwxrwx 1 jdoe 168 Jan 13 1998
file.exe -rw-rw-rw- 1 nobody 382 Nov 18 1998
old.profile -rw------- 1 jdoe 652 Jul 12
1216 old.xsession drwx------ 2 jdoe 8192 Jun
23 1321 thesis/ -rw-r--r-- 1 jdoe 1186776 Jul
13 1507 win32tutorial.ps
4
Types of file access
  • Read
  • Allows viewing at the contents of the file
  • Allows listing the contents of a directory
  • Write
  • Allows changing or deleting the file
  • Allows creation of files within a directory
  • Execute
  • Allows execution of a program
  • Allows traversal of a directory
  • You can't access files or directories inside a
    directory without execute permissions on that
    directory

5
Categories of access rights
  • User/owner
  • The person who owns/created the file
  • Group
  • Each file and directory belongs to a group
  • Each user is a member of 1 or more groups
  • Others
  • Everyone else that has access to the computer
  • All
  • The set of all users, including the User, Group
    members, and Others

6
To change permissions
  • chmod
  • changes the access mode of a file
  • Two methods exist
  • symbolic
  • absolute

7
chmod - symbolic
  • chmod requires
  • which permissions to add or subtract
  • the category of user to change
  • chmod who operation permission file

8
chmod - symbolic
  • chmod who operation permission file
  • Who
  • u user/owner
  • g group
  • o others/world
  • a all
  • Note, these are all lower-case letters

9
chmod - symbolic
  • chmod who operation permission file
  • Operation
  • add permission
  • - remove permission
  • set permission

10
chmod - symbolic
  • chmod who operation permission file
  • Permission
  • r read permission
  • w write permission
  • x execute permission
  • Note these are lower case letters

11
chmod - examples
  • chmod o-w temp
  • chmod u-r bar
  • chmod grw home.html
  • chmod arw myFile
  • chmod ax homework

12
chmod - absolute
  • Absolute
  • specify a numeric equivalent for a set of
    permissions
  • You specify all permissions at once
  • This is not for the faint of heart

13
chmod - absolute
  • chmod xxx file
  • Where each x is some number from 0 - 7
  • Each number specifies a level of privileges for a
    specific group

14
chmod - absolute
  • e.g.,

chmod 644 moocow.txt
User permission
World permission
Group permission
15
chmod - absolute
  • Permissions
  • Read 4
  • Write 2
  • Execute 1
  • Set permissions by adding the values of all the
    permissions you wish to set

16
chmod - examples
  • To give yourself read write permission and no
    permission to anyone else
  • chmod 600 foobar.txt
  • To give yourself read write permission and
    everyone else read permission only
  • chmod 644 index.html
  • To give yourself full access to a directory, and
    everyone else read execute permission only
  • chmod 755 homeDirectory

17
chgrp
  • Change the group associated with a file or
    directory
  • Each user can belong to several groups
  • The system administrator handles group
    permissions
  • The owner of a file or direcotry can set its
    group to any group to which the owner belongs
  • A file or directory can be associated with only
    one group
  • Example
  • chgrp cs140 myDirectory
  • chgrp is not covered in our text
  • How can you find out more about chgrp?

18
Viewing group association
  • Use the ls -lg command

drwx------ 2 jdoe cs140 8192 Jul 12 1226
nsmail/ -rw-r--r-- 1 jdoe cs140 945 Mar 15
1601 old.cshrc -rwxrwxrwx 1 jdoe st 168 Jan
13 1998 file.exe -rw-rw-rw- 1 nobody
wheel 382 Nov 18 1998 old.profile -rw-------
1 jdoe st 652 Jul 12 1216 old.xsession drwx----
-- 2 jdoe cs140 8192 Jun 23 1321
thesis/ -rw-r--r-- 1 jdoe csclub 1186776 Jul
13 1507 win32tut.ps
Write a Comment
User Comments (0)
About PowerShow.com