+ All Categories
Home > Documents > CIS 90 - Lesson 7

CIS 90 - Lesson 7

Date post: 03-Jan-2016
Category:
Upload: idola-yang
View: 38 times
Download: 2 times
Share this document with a friend
Description:
CIS 90 - Lesson 7. Lesson Module Status Slides – draft Properties - done Flash cards – No-stress quiz – Web Calendar summary – Web book pages – done Commands – done Lab – Supplies – Class PC's – NA Hide script – Next class. CIS 90 - Lesson 7. Quiz. - PowerPoint PPT Presentation
Popular Tags:
48
CIS 90 - Lesson 7 Lesson Module Status • Slides – draft • Properties - done • Flash cards – • No-stress quiz – • Web Calendar summary – • Web book pages – done • Commands – done • Lab – • Supplies – • Class PC's – NA • Hide script – Next class
Transcript
Page 1: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Lesson Module Status• Slides – draft• Properties - done• Flash cards – • No-stress quiz – • Web Calendar summary – • Web book pages – done• Commands – done• Lab – • Supplies – • Class PC's – NA• Hide script – Next class

Page 2: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Quiz

Please close your books, turn off your monitor, take out a blank piece of paper and answer the following questions:

•What option for the rm command provides confirmation when deleting files?

•What command is used to rename a file?

•If two files are hard linked do they have the same or different inode numbers?

Page 3: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Objectives Agenda

• Be able to reassign user and group file ownerships

• Identify permissions for ordinary and directory files

• Use chmod to set and change file permissions

• Define the default permissions for new files

• Quiz

• Review test results

• Question on previous material

• File permissions

• Wrap up

= hands on exercise for topic

File Permissions

Page 4: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Housekeeping

Page 5: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Test 1 – Most Missed Questions

1 xxx2 x3 x4 xxxx5 xxxxx67 x8910

1. How are executable files (binary files or shell scripts) displayed in ls command output? They are the green ones. With the -l option the x permission bits are seen, with the -F option they will have a *

2. What UNIX command prints your current working directory? pwd3. Is ../guest/Poems a relative or absolute path? relative4. In what file are all the user accounts stored? /etc/passwd5. What environment variable is used by the shell to determine which directories to

search when locating a command? PATH6. What metacharacter allows you to put multiple commands on one line? ; (semicolon)7. Who initiated, and with the help of other programmers, developed the first Linux

kernel? Linux Torvalds8. With /bin/mail, where do all messages that have been read go after issuing the quit

command? Into the mbox file in the users home directory.9. Was UNIX/Linux designed for single user or multi-user operation? multi-user10. What are the three elements that make up a UNIX file? The filename, the inode, and

the data

Page 6: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Test 1 – Most Missed Questions

111213 xxx141516 xxxxxxxxxxxx17xx18 xxxxxxxx19 xxxxxx20 x

11. Is /boot/grub/grub.conf a relative or absolute path? absolute

12. What is the program called that prompts you for a command, then locates that command and executes it? The Shell

13. What command shows the name of the computer you are using? hostname

14. What option on the ls command will show inode numbers?? I15. What day of the week is May 5, 1993? Wednesday

16. What is the name and version of the Linux kernel you are using? Linux #1 SMP Thu May 22 09:01:29 EDT 2008

17. In your home directory you will find another directory called depot. What is the last line of text in the file named hello.txt? ISN’T THIS FUN???

18. What terminal type are you using? xterm19. Type the command cat /etc/shadow. Which program writes the

error message? cat20. Type the command Cat /etc/shadow. Which programs writes the

error message? bash

Page 7: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Test 1 – Most Missed Questions

21 xxxxxxx22 xxxxx23 xxxx24 x25 xxxxxxxxx26 xxx27 xx28 xxxxxxxxxxxxx29 x30 xxxxx

21. What is the value of your $PS1 environment variable? [\u@\h \W]\$22. What command will set your prompt to: “Your wish is my command:

> ”? PS1=”Your wish is my command: > ”23. Starting in /u and descending down subfolders, what are the names of the two

files in the last and deepest folder? dorothy, toto 24. What is the inode number of /etc/passwd? 19866025. What is the relative path from your home directory to the file

/etc/passwd ? ../../../etc/passwd26. What is the absolute path to the file /etc/passwd ? /etc/passwd27. What command and option will show the permissions, owner and size of

/etc/passwd? ls –l /etc/passwd28. From your home directory change to the Poems/Yeats/ directory. What one-

liner command would clear the screen and print the last line of all three Yeats poems without having to type the names of each individual poem file name? clear; tail -n 1 *

29. Check your email on Opus. What is Benji’s favorite game to play? gopher30. Calculate: (23^2 * 4 – 100) – sqrt(64)and email (using /bin/mail) the answer to rsimms mail rsimmsSubject: Q302008

Page 8: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Test 1 – Most Missed Questions

31 xxxxxxxxxx32 x33 xxxxxxxxxx34 xxxxxxxxxxxx35 xxxxx

31. In what directory is the crash command found?/usr/bin 32. What does the shred command do?Overwrite the specified FILE(s) repeatedly, in order to make it harder for even

very expensive hardware probing to recover the data.

33. How many words are in the whitebirds poem? 17334. How can you keep a copy of messages you send with /bin/mail? cc: yourself35. What files in your home directory match p*[23]? proposal2, proposal3

Page 9: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Previous material and assignment

1. Questions on last Lab assignment?

2. Questions on File Management commands?

Page 10: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Permissions

Page 11: CIS 90 - Lesson 7

CIS 90 - Lesson 5

Superblock

Inode Table

ext2 file system

Data Blocks

[simmsben@opus ~]$ls -il letter102609 -rw-r--r-- 1 simmsben cis90 1044 Jul 20 2001 letter

Hello Mother! Hello Father!

Here I am at Camp Granada. Things are very entertaining,and they say we'll have some fun when it stops raining.

All the counselors hate the waiters, and the lake hasalligators. You remember Leonard Skinner? He gotptomaine poisoning last night after dinner.

Now I don't want this to scare you, but my bunk mate hasmalaria. You remember Jeffrey Hardy? Their about toorganize a searching party.

Take me home, oh Mother, Father, take me home! I hate Granada.Don't leave me out in the forest where I might get eatenby a bear! Take me home, I promise that I won't make noise,or mess the house with other boys, oh please don't make mestay -- I've been here one whole day.

Dearest Father, darling Mother, how's my precious littlebrother? I will come home if you miss me. I will evenlet Aunt Bertha hug and kiss me!

Wait a minute! It's stopped hailing! Guys are swimming!Guys are sailing! Playing baseball, gee that's better!Mother, Father, kindly disregard this letter.

Alan Sherman

bigfile 102574bin 102575letter 102609

bigfile 102574bin 102575letter 102609

102609

-

1

simmsben

cis90

1044

2001-07-20

2008-08-08

2008-06-20

Pointer(s) to data blocks

inode number

Type

Number of links

User

Group

Size

Modification time

Access Time

change time

Pointer(s) to data blocks

rw-r—r-- Permissions

Page 12: CIS 90 - Lesson 7

File PermissionsRelevant fields from the inode

CIS 90 - Lesson 7

/

A. Owner of the file: uid B. Group Membership of the file: gid C. Permissions: read, write, execute

rwx rwx rwx owner group other

1. the Read permission has a numeric value of 4 2. the Write permission has a numeric value of 2 3. the EXecute permission has a numeric value of 1

The total permissions assigned to a file for a particular identity is the sum of these three values.

Page 13: CIS 90 - Lesson 7

File PermissionsViewing relevant fields from the inode

CIS 90 - Lesson 7

/

[simmsben@opus ~]$ ls -li letter102609 -rw-r--r-- 2 simmsben cis90 1044 Jul 20 2001 letter

[simmsben@opus ~]$ stat letter File: `letter' Size: 1044 Blocks: 16 IO Block: 4096

regular fileDevice: 805h/2053d Inode: 102609 Links: 2Access: (0644/-rw-r--r--) Uid: ( 1160/simmsben) Gid: ( 103/

cis90)Access: 2008-10-15 14:15:43.000000000 -0700Modify: 2001-07-20 15:04:39.000000000 -0700Change: 2008-10-15 14:16:13.000000000 -0700[simmsben@opus ~]$

102609

-

1

simmsben

cis90

1044

2001-07-20

2008-10-15

2008-10-15

Pointer(s) to data blocks

inode number

Type

Number of links

User

Group

Size

Modification time

Access Time

change time

Pointer(s) to data blocks

rw-r—r-- Permissions

Page 14: CIS 90 - Lesson 7

File PermissionsRelevant Commands

CIS 90 - Lesson 7

/

chown - Changes the ownership of a file. (Only superuser has this privilege)

chgrp - Changes the group of a file. (Only groups that you belong to)

chmod - Changes the permissions of a file. • Numeric: chmod 640 letter (sets the permissions for a file) • Mnemonic: chmod ug+rw letter (changes the permission

settings)

Mnemonic: u=user(owner), g=group, o=other r=read, w=write, x=execute

umask - Sets the default mask applied to permissions for newly created files.

Page 15: CIS 90 - Lesson 7

[simmsben@opus Directory3]$ touch myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-rw-r-- 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$ chown rsimms myfilechown: changing ownership of `myfile': Operation not permitted[simmsben@opus Directory3]$ chgrp users myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-rw-r-- 1 simmsben users 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$[simmsben@opus Directory3]$ chgrp cis90 myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-rw-r-- 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$

CIS 90 - Lesson 7

File Permissionschown and chgrp command - examples

Only root can use chown

Page 16: CIS 90 - Lesson 7

CIS 90 - Lesson 7

/

[simmsben@opus Directory3]$ ls -ltotal 4-rwxrwxr-- 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$ chmod -x myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-rw-r-- 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$ chmod og+x myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-rwxr-x 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$ chmod go-rwx myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw------- 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$

File Permissionschmod command - examples

Page 17: CIS 90 - Lesson 7

File Permissionschmod command - examples

CIS 90 - Lesson 7

/

[simmsben@opus Directory3]$ chmod 664 myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-rw-r-- 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$ chmod 777 myfile[simmsben@opus Directory3]$ ls -ltotal 4-rwxrwxrwx 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$ chmod 640 myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-r----- 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$ chmod 000 myfile[simmsben@opus Directory3]$ ls -ltotal 4---------- 1 simmsben cis90 0 Oct 15 14:40 myfile[simmsben@opus Directory3]$ chmod 644 myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-r--r-- 1 simmsben cis90 0 Oct 15 14:40 myfile

Page 18: CIS 90 - Lesson 7

File PermissionsCommands that require file permissions

CIS 90 - Lesson 7

/

Permission File Directory

Read (4) cat, more, file, head, tail, cp

ls

Write (2) vi, saving mail cp, mv, rm, ln

Execute (1) $ command cd, ls -l, find

Page 19: CIS 90 - Lesson 7

File Permissionsexamples

CIS 90 - Lesson 7

/

[simmsben@opus ~]$ chmod u-w Directory3[simmsben@opus ~]$ ls -ld Directory3dr-xrwxr-x 2 simmsben cis90 4096 Oct 15 15:00 Directory3[simmsben@opus ~]$ cd Directory3[simmsben@opus Directory3]$ ls -ltotal 4-rw-r--r-- 1 simmsben cis90 0 Oct 15 15:00 myfile[simmsben@opus Directory3]$ rm myfilerm: cannot remove `myfile': Permission denied[simmsben@opus Directory3]$ chmod 777 myfile[simmsben@opus Directory3]$ ls -ltotal 4-rwxrwxrwx 1 simmsben cis90 0 Oct 15 15:00 myfile[simmsben@opus Directory3]$ rm myfilerm: cannot remove `myfile': Permission denied[simmsben@opus Directory3]$

Page 20: CIS 90 - Lesson 7

File Permissionsexample

CIS 90 - Lesson 7

/

[simmsben@opus ~]$ ls -ld Directory3drwxr-xr-x 2 simmsben cis90 4096 Oct 15 15:00 Directory3[simmsben@opus ~]$ cd Directory3[simmsben@opus Directory3]$ chmod 000 myfile[simmsben@opus Directory3]$ ls -ltotal 4---------- 1 simmsben cis90 0 Oct 15 15:00 myfile[simmsben@opus Directory3]$ rm myfilerm: remove write-protected regular empty file `myfile'? yes[simmsben@opus Directory3]$

Page 21: CIS 90 - Lesson 7

File Permissionsexample

CIS 90 - Lesson 7

/

[simmsben@opus ~]$ ls -ld Directory3drwxr-xr-x 2 simmsben cis90 4096 Oct 15 15:00 Directory3[simmsben@opus ~]$ cd Directory3[simmsben@opus Directory3]$ chmod 000 myfile[simmsben@opus Directory3]$ ls -ltotal 4---------- 1 simmsben cis90 0 Oct 15 15:00 myfile[simmsben@opus Directory3]$ rm myfilerm: remove write-protected regular empty file `myfile'? yes[simmsben@opus Directory3]$

Page 22: CIS 90 - Lesson 7

File PermissionsDefault Permissions

CIS 90 - Lesson 7

/

Default permissions • Default permissions for an ordinary file: rw-rw-rw-     666 • Default permissions for directories: rwxrwxrwx     777

The umask is a three digit octal value whose bits strip away (mask off) default permissions:

• umask 777 - strips off all permissions from a file or directory • umask 000 - leaves the default permissions alone • umask 022 - strips off write permissions from group and other

Page 23: CIS 90 - Lesson 7

File Permissionsumask - examples

CIS 90 - Lesson 7

/

[simmsben@opus Directory3]$ umask0002[simmsben@opus Directory3]$ rm myfile[simmsben@opus Directory3]$ touch myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-rw-r-- 1 simmsben cis90 0 Oct 15 14:59 myfile[simmsben@opus Directory3]$

[simmsben@opus Directory3]$ umask 000[simmsben@opus Directory3]$ rm myfile[simmsben@opus Directory3]$ touch myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-rw-rw- 1 simmsben cis90 0 Oct 15 15:00 myfile[simmsben@opus Directory3]$

[simmsben@opus Directory3]$ umask 022[simmsben@opus Directory3]$ rm myfile[simmsben@opus Directory3]$ touch myfile[simmsben@opus Directory3]$ ls -ltotal 4-rw-r--r-- 1 simmsben cis90 0 Oct 15 15:00 myfile[simmsben@opus Directory3]$

666-002664

rw_rw_r__

666-000666

rw_rw_rw_

666-022644

rw_r__r__

Page 24: CIS 90 - Lesson 7

File Permissionsexercise - setup

CIS 90 - Lesson 7

/

/home/cis90/simmsben $ mkdir Directory1 Directory2/home/cis90/simmsben $ chmod 751 Directory1/home/cis90/simmsben $ chmod 775 Directory2/home/cis90/simmsben $ ls -ld Directory*drwxr-x--x 2 simmsben cis90 4096 Oct 15 11:11 Directory1drwxrwxr-x 2 simmsben cis90 4096 Oct 15 11:11 Directory2

/home/cis90/simmsben $ cd Directory1

/home/cis90/simmsben/Directory1 $ echo "blah blah blah" > file1/home/cis90/simmsben/Directory1 $ echo "blah blah blah" > file2/home/cis90/simmsben/Directory1 $ echo "blah blah blah" > file3

/home/cis90/simmsben/Directory1 $ chmod 664 file1/home/cis90/simmsben/Directory1 $ chmod 755 file2/home/cis90/simmsben/Directory1 $ chmod 554 file3

/home/cis90/simmsben/Directory1 $ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3

Page 25: CIS 90 - Lesson 7

File Permissionsexercise – can owner change these files?

CIS 90 - Lesson 7

/

/home/cis90/simmsben/Directory1 $ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3/home/cis90/simmsben/Directory1 $

/home/cis90/simmsben/Directory1 $ echo "changes" > file1

Page 26: CIS 90 - Lesson 7

File Permissionsexercise – can owner change these files?

CIS 90 - Lesson 7

/

/home/cis90/simmsben/Directory1 $ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3/home/cis90/simmsben/Directory1 $

/home/cis90/simmsben/Directory1 $ echo "changes" > file1

/home/cis90/simmsben/Directory1 $ echo "changes" > file2

Page 27: CIS 90 - Lesson 7

File Permissionsexercise – can owner change these files?

CIS 90 - Lesson 7

/

/home/cis90/simmsben/Directory1 $ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3/home/cis90/simmsben/Directory1 $

/home/cis90/simmsben/Directory1 $ echo "changes" > file1/home/cis90/simmsben/Directory1 $ echo "changes" > file2

/home/cis90/simmsben/Directory1 $ echo "changes" > file3

Page 28: CIS 90 - Lesson 7

File Permissionsexercise – can owner change these files?

CIS 90 - Lesson 7

/

/home/cis90/simmsben/Directory1 $ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3/home/cis90/simmsben/Directory1 $

/home/cis90/simmsben/Directory1 $ echo "changes" > file1/home/cis90/simmsben/Directory1 $ echo "changes" > file2/home/cis90/simmsben/Directory1 $ echo "changes" > file3-bash: file3: Permission denied/home/cis90/simmsben/Directory1 $

/home/cis90/simmsben/Directory1 $ cat f*changeschangesblah blah blah/home/cis90/simmsben/Directory1 $

Page 29: CIS 90 - Lesson 7

File Permissionsexercise – can group user change these files?

CIS 90 - Lesson 7

/

[roddyduk@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 8 Oct 15 11:48 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3

[roddyduk@opus Directory1]$ echo "changes" > file1

Page 30: CIS 90 - Lesson 7

File Permissionsexercise – can group user change these files?

CIS 90 - Lesson 7

/

[roddyduk@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 8 Oct 15 11:48 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3[roddyduk@opus Directory1]$ echo "changes" > file1

[roddyduk@opus Directory1]$ echo "changes" > file2

Page 31: CIS 90 - Lesson 7

File Permissionsexercise – can group user change these files?

CIS 90 - Lesson 7

/

[roddyduk@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 8 Oct 15 11:48 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3[roddyduk@opus Directory1]$ echo "changes" > file1[roddyduk@opus Directory1]$ echo "changes" > file2-bash: file2: Permission denied

[roddyduk@opus Directory1]$ echo "changes" > file3

Page 32: CIS 90 - Lesson 7

File Permissionsexercise – can group user change these files?

CIS 90 - Lesson 7

/

[roddyduk@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 8 Oct 15 11:48 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3[roddyduk@opus Directory1]$ echo "changes" > file1[roddyduk@opus Directory1]$ echo "changes" > file2-bash: file2: Permission denied[roddyduk@opus Directory1]$ echo "changes" > file3-bash: file3: Permission denied[roddyduk@opus Directory1]$

Page 33: CIS 90 - Lesson 7

File Permissionsexercise – can other user change these files?

CIS 90 - Lesson 7

/

[simmsmar@opus ~]$ ls -l /home/cis90/simmsben/Directory1ls: /home/cis90/simmsben/Directory1: Permission denied[simmsmar@opus ~]$ echo "simmsmar" > /home/cis90/simmsben/Directory1/file1-bash: /home/cis90/simmsben/Directory1/file1: Permission denied[simmsmar@opus ~]$ echo "simmsmar" > /home/cis90/simmsben/Directory1/file2-bash: /home/cis90/simmsben/Directory1/file2: Permission denied[simmsmar@opus ~]$ echo "simmsmar" > /home/cis90/simmsben/Directory1/file3-bash: /home/cis90/simmsben/Directory1/file3: Permission denied[simmsmar@opus ~]$

[simmsben@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 9 Oct 15 12:15 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3[simmsben@opus Directory1]$

Page 34: CIS 90 - Lesson 7

File Permissionsexercise – can owner delete these files?

CIS 90 - Lesson 7

/

[simmsben@opus Directory1]$ ls -lddrwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 .[simmsben@opus Directory1]$[simmsben@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3[simmsben@opus Directory1]$ rm file1[simmsben@opus Directory1]$ rm file2[simmsben@opus Directory1]$ rm file3rm: remove write-protected regular file `file3'? y[simmsben@opus Directory1]$

Page 35: CIS 90 - Lesson 7

File Permissionsexercise – can group user delete these files?

CIS 90 - Lesson 7

/

[simmsben@opus Directory1]$ ls -lddrwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 .[simmsben@opus Directory1]$[simmsben@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3

[roddyduk@opus ~]$ rm ../simmsben/Directory1/file1rm: cannot remove `../simmsben/Directory1/file1': Permission denied[roddyduk@opus ~]$ rm ../simmsben/Directory1/file2rm: remove write-protected regular file `../simmsben/Directory1/file2'? yrm: cannot remove `../simmsben/Directory1/file2': Permission denied[roddyduk@opus ~]$ rm ../simmsben/Directory1/file3rm: remove write-protected regular file `../simmsben/Directory1/file3'? yrm: cannot remove `../simmsben/Directory1/file3': Permission denied[roddyduk@opus ~]$

Page 36: CIS 90 - Lesson 7

File Permissionsexercise – can other user delete these files?

CIS 90 - Lesson 7

/

[simmsben@opus Directory1]$ ls -lddrwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 .[simmsben@opus Directory1]$[simmsben@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3

[simmsmar@opus ~]$ rm /home/cis90/simmsben/Directory1/file1rm: cannot remove `/home/cis90/simmsben/Directory1/file1': Permission denied[simmsmar@opus ~]$ rm /home/cis90/simmsben/Directory1/file2rm: cannot remove `/home/cis90/simmsben/Directory1/file2': Permission denied[simmsmar@opus ~]$ rm /home/cis90/simmsben/Directory1/file3rm: cannot remove `/home/cis90/simmsben/Directory1/file3': Permission denied[simmsmar@opus ~]$

Page 37: CIS 90 - Lesson 7

File Permissionsexercise – can owner read these files?

CIS 90 - Lesson 7

/

[simmsben@opus ~]$ ls Directory1file1 file2 file3[simmsben@opus ~]$ cat Directory1/*blah blah blahblah blah blahblah blah blah[simmsben@opus ~]$

Page 38: CIS 90 - Lesson 7

File Permissionsexercise – can group user read these files?

CIS 90 - Lesson 7

/

[simmsben@opus Directory1]$ ls -lddrwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 .[simmsben@opus Directory1]$[simmsben@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3

[roddyduk@opus ~]$ cat ../simmsben/Directory1/file*blah blah blahblah blah blahblah blah blah[roddyduk@opus ~]$

Page 39: CIS 90 - Lesson 7

File Permissionsexercise – can other user read these files?

CIS 90 - Lesson 7

/

drwxr-x--- 31 rsimms cis90 4096 Oct 8 09:47 /home/cis90[simmsben@opus ~]$ ls -ld /home/cis90/simmsben/drwxr-xr-x 12 simmsben cis90 4096 Oct 15 13:45 /home/cis90/simmsben/[simmsben@opus ~]$[simmsben@opus Directory1]$ ls -lddrwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 .[simmsben@opus Directory1]$[simmsben@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3

[simmsmar@opus ~]$ cat /home/cis90/simmsben/Directory1/file1cat: /home/cis90/simmsben/Directory1/file1: Permission denied[simmsmar@opus ~]$ cat /home/cis90/simmsben/Directory1/file2cat: /home/cis90/simmsben/Directory1/file2: Permission denied[simmsmar@opus ~]$ cat /home/cis90/simmsben/Directory1/file3cat: /home/cis90/simmsben/Directory1/file3: Permission denied[simmsmar@opus ~]$

Page 40: CIS 90 - Lesson 7

File Permissionsexercise – can owner execute these files?

CIS 90 - Lesson 7

/

[simmsben@opus Directory1]$ ls -ltotal 32-rw-rw-r-- 1 simmsben cis90 41 Oct 15 13:16 file1-rwxr-xr-x 1 simmsben cis90 41 Oct 15 13:17 file2-r-xr-xr-- 1 simmsben cis90 41 Oct 15 13:18 file3-rw-rw-r-- 1 simmsben cis90 41 Oct 15 13:16 program[simmsben@opus Directory1]$ ./file1-bash: ./file1: Permission denied[simmsben@opus Directory1]$ ./file2blah blah blah[simmsben@opus Directory1]$ ./file3blah blah blah[simmsben@opus Directory1]$

==> file1 <==#!/bin/bashecho "blah blah blah"exit 0

==> file2 <==#!/bin/bashecho "blah blah blah"exit 0

==> file3 <==#!/bin/bashecho "blah blah blah"exit 0

Page 41: CIS 90 - Lesson 7

File Permissionsexercise – can group user execute these files?

CIS 90 - Lesson 7

/

[simmsben@opus Directory1]$ ls -lddrwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 .[simmsben@opus Directory1]$[simmsben@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3

[roddyduk@opus ~]$ /home/cis90/simmsben/Directory1/file1-bash: /home/cis90/simmsben/Directory1/file1: Permission denied[roddyduk@opus ~]$ /home/cis90/simmsben/Directory1/file2blah blah blah[roddyduk@opus ~]$ /home/cis90/simmsben/Directory1/file3blah blah blah[roddyduk@opus ~]$

Page 42: CIS 90 - Lesson 7

File Permissionsexercise – can other user execute these files?

CIS 90 - Lesson 7

/

[simmsben@opus ~]$ ls -ld /home/cis90drwxr-x--- 31 rsimms cis90 4096 Oct 8 09:47 /home/cis90[simmsben@opus ~]$ ls -ld /home/cis90/simmsben/drwxr-xr-x 12 simmsben cis90 4096 Oct 15 13:45 /home/cis90/simmsben/[simmsben@opus ~]$[simmsben@opus Directory1]$ ls -lddrwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 .[simmsben@opus Directory1]$[simmsben@opus Directory1]$ ls -ltotal 24-rw-rw-r-- 1 simmsben cis90 15 Oct 15 11:13 file1-rwxr-xr-x 1 simmsben cis90 15 Oct 15 11:13 file2-r-xr-xr-- 1 simmsben cis90 15 Oct 15 11:13 file3

[simmsmar@opus ~]$ /home/cis90/simmsben/Directory1/file1-bash: /home/cis90/simmsben/Directory1/file1: Permission denied[simmsmar@opus ~]$ /home/cis90/simmsben/Directory1/file2-bash: /home/cis90/simmsben/Directory1/file2: Permission denied[simmsmar@opus ~]$ /home/cis90/simmsben/Directory1/file3-bash: /home/cis90/simmsben/Directory1/file3: Permission denied[simmsmar@opus ~]$

Page 43: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Lab 6

Page 44: CIS 90 - Lesson 7

CIS 90 - Lesson 7

http://simms-teach.com/docs/cis90/cis90lab6.html

Page 45: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Wrap up

Page 46: CIS 90 - Lesson 7

CIS 191 - Lesson 7

New commands:chgrp change file's groupchmod change file permissionschown change file owner (superuser only)umask change permission mask

New Files and Directories:NA

Page 47: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Next Class

Assignment: Check Calendar Page on web site to see what is due next week.

Quiz questions for next class:

•With a umask of 002 what permissions would a newly created file have?

•What is the numeric permission equivalent of rwxr_xr__ ?

•Does chmod o+w give write permission to the owner or to other users?

Page 48: CIS 90 - Lesson 7

CIS 90 - Lesson 7

Backup


Recommended