1 / 48

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. CIS 90 - Lesson 7. Quiz.

idola-yang
Download Presentation

CIS 90 - Lesson 7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. 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?

  3. CIS 90 - Lesson 7 File Permissions  = hands on exercise for topic

  4. CIS 90 - Lesson 7 Housekeeping

  5. CIS 90 - Lesson 7 Test 1 – Most Missed Questions 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 * What UNIX command prints your current working directory? pwd Is ../guest/Poems a relative or absolute path? relative In what file are all the user accounts stored? /etc/passwd What environment variable is used by the shell to determine which directories to search when locating a command? PATH What metacharacter allows you to put multiple commands on one line? ; (semicolon) Who initiated, and with the help of other programmers, developed the first Linux kernel? Linux Torvalds 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. Was UNIX/Linux designed for single user or multi-user operation? multi-user 10. What are the three elements that make up a UNIX file? The filename, the inode, and the data 1 xxx 2 x 3 x 4 xxxx 5 xxxxx 6 7 x 8 9 10

  6. CIS 90 - Lesson 7 Test 1 – Most Missed Questions Is /boot/grub/grub.conf a relative or absolute path? absolute What is the program called that prompts you for a command, then locates that command and executes it? The Shell What command shows the name of the computer you are using? hostname What option on the ls command will show inode numbers?? I What day of the week is May 5, 1993? Wednesday What is the name and version of the Linux kernel you are using? Linux #1 SMP Thu May 22 09:01:29 EDT 2008 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??? What terminal type are you using? xterm Type the command cat /etc/shadow. Which program writes the error message? cat Type the command Cat /etc/shadow. Which programs writes the error message? bash • 11 • 12 • 13 xxx • 14 • 15 • 16 xxxxxxxxxxxx • xx • 18 xxxxxxxx • 19 xxxxxx • 20 x

  7. CIS 90 - Lesson 7 Test 1 – Most Missed Questions What is the value of your $PS1 environment variable? [\u@\h \W]\$ What command will set your prompt to: “Your wish is my command: > ”?PS1=”Your wish is my command: > ” Starting in /u and descending down subfolders, what are the names of the two files in the last and deepest folder? dorothy, toto What is the inode number of /etc/passwd? 198660 What is the relative path from your home directory to the file /etc/passwd ? ../../../etc/passwd What is the absolute path to the file /etc/passwd ? /etc/passwd What command and option will show the permissions, owner and size of /etc/passwd? ls –l /etc/passwd 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 * Check your email on Opus. What is Benji’s favorite game to play? gopher Calculate: (23^2 * 4 – 100) – sqrt(64) and email (using /bin/mail) the answer to rsimms mail rsimms Subject: Q30 2008 21 xxxxxxx 22 xxxxx 23 xxxx 24 x 25 xxxxxxxxx 26 xxx 27 xx 28 xxxxxxxxxxxxx 29 x 30 xxxxx

  8. CIS 90 - Lesson 7 Test 1 – Most Missed Questions In what directory is the crash command found? /usr/bin 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. How many words are in the whitebirds poem? 173 How can you keep a copy of messages you send with /bin/mail? cc: yourself What files in your home directory match p*[23]? proposal2, proposal3 31 xxxxxxxxxx 32 x 33 xxxxxxxxxx 34 xxxxxxxxxxxx 35 xxxxx

  9. CIS 90 - Lesson 7 Previous material and assignment Questions on last Lab assignment? Questions on File Management commands?

  10. CIS 90 - Lesson 7 Permissions

  11. CIS 90 - Lesson 5 bigfile 102574 bin 102575 letter 102609 102609 inode number ext2 file system Superblock - Type rw-r—r-- Permissions 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 has alligators. You remember Leonard Skinner? He got ptomaine poisoning last night after dinner. Now I don't want this to scare you, but my bunk mate has malaria. You remember Jeffrey Hardy? Their about to organize 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 eaten by 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 me stay -- I've been here one whole day. Dearest Father, darling Mother, how's my precious little brother? I will come home if you miss me. I will even let 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 Inode Table 1 Number of links simmsben User cis90 Group Data Blocks 1044 Size 2001-07-20 Modification time 2008-08-08 Access Time 2008-06-20 change time Pointer(s) to data blocks Pointer(s) to data blocks [simmsben@opus ~]$ls -il letter 102609 -rw-r--r-- 1 simmsben cis90 1044 Jul 20 2001 letter

  12. CIS 90 - Lesson 7 File Permissions Relevant fields from the inode • Owner of the file: uid • Group Membership of the file: gid • Permissions: read, write, executerwxrwxrwx owner group other • the Read permission has a numeric value of 4 • the Write permission has a numeric value of 2 • 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. /

  13. CIS 90 - Lesson 7 File Permissions Viewing relevant fields from the inode 102609 inode number - Type [simmsben@opus ~]$ ls -li letter 102609 -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 file Device: 805h/2053d Inode: 102609 Links: 2 Access: (0644/-rw-r--r--) Uid: ( 1160/simmsben) Gid: ( 103/ cis90) Access: 2008-10-15 14:15:43.000000000 -0700 Modify: 2001-07-20 15:04:39.000000000 -0700 Change: 2008-10-15 14:16:13.000000000 -0700 [simmsben@opus ~]$ rw-r—r-- Permissions 1 Number of links simmsben User cis90 Group 1044 Size 2001-07-20 Modification time 2008-10-15 Access Time / 2008-10-15 change time Pointer(s) to data blocks Pointer(s) to data blocks

  14. CIS 90 - Lesson 7 File Permissions Relevant Commands • 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: chmodug+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. /

  15. CIS 90 - Lesson 7 File Permissions chown and chgrp command - examples [simmsben@opus Directory3]$ touch myfile [simmsben@opus Directory3]$ ls -l total 4 -rw-rw-r-- 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ chownrsimmsmyfile chown: changing ownership of `myfile': Operation not permitted [simmsben@opus Directory3]$ chgrp users myfile [simmsben@opus Directory3]$ ls -l total 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 -l total 4 -rw-rw-r-- 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ Only root can use chown

  16. CIS 90 - Lesson 7 File Permissions chmod command - examples [simmsben@opus Directory3]$ ls -l total 4 -rwxrwxr-- 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ chmod -x myfile [simmsben@opus Directory3]$ ls -l total 4 -rw-rw-r-- 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ chmod og+x myfile [simmsben@opus Directory3]$ ls -l total 4 -rw-rwxr-x 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ chmod go-rwx myfile [simmsben@opus Directory3]$ ls -l total 4 -rw------- 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ /

  17. CIS 90 - Lesson 7 File Permissions chmod command - examples [simmsben@opus Directory3]$ chmod 664 myfile [simmsben@opus Directory3]$ ls -l total 4 -rw-rw-r-- 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ chmod 777 myfile [simmsben@opus Directory3]$ ls -l total 4 -rwxrwxrwx 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ chmod 640 myfile [simmsben@opus Directory3]$ ls -l total 4 -rw-r----- 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ chmod 000 myfile [simmsben@opus Directory3]$ ls -l total 4 ---------- 1 simmsben cis90 0 Oct 15 14:40 myfile [simmsben@opus Directory3]$ chmod 644 myfile [simmsben@opus Directory3]$ ls -l total 4 -rw-r--r-- 1 simmsben cis90 0 Oct 15 14:40 myfile /

  18. CIS 90 - Lesson 7 File Permissions Commands that require file permissions /

  19. CIS 90 - Lesson 7 File Permissions examples [simmsben@opus ~]$ chmod u-w Directory3 [simmsben@opus ~]$ ls -ld Directory3 dr-xrwxr-x 2 simmsben cis90 4096 Oct 15 15:00 Directory3 [simmsben@opus ~]$ cd Directory3 [simmsben@opus Directory3]$ ls -l total 4 -rw-r--r-- 1 simmsben cis90 0 Oct 15 15:00 myfile [simmsben@opus Directory3]$ rm myfile rm: cannot remove `myfile': Permission denied [simmsben@opus Directory3]$ chmod 777 myfile [simmsben@opus Directory3]$ ls -l total 4 -rwxrwxrwx 1 simmsben cis90 0 Oct 15 15:00 myfile [simmsben@opus Directory3]$ rm myfile rm: cannot remove `myfile': Permission denied [simmsben@opus Directory3]$ /

  20. CIS 90 - Lesson 7 File Permissions example [simmsben@opus ~]$ ls -ld Directory3 drwxr-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 -l total 4 ---------- 1 simmsben cis90 0 Oct 15 15:00 myfile [simmsben@opus Directory3]$ rm myfile rm: remove write-protected regular empty file `myfile'? yes [simmsben@opus Directory3]$ /

  21. CIS 90 - Lesson 7 File Permissions example [simmsben@opus ~]$ ls -ld Directory3 drwxr-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 -l total 4 ---------- 1 simmsben cis90 0 Oct 15 15:00 myfile [simmsben@opus Directory3]$ rm myfile rm: remove write-protected regular empty file `myfile'? yes [simmsben@opus Directory3]$ /

  22. CIS 90 - Lesson 7 File Permissions Default Permissions • 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 /

  23. CIS 90 - Lesson 7 File Permissions umask - examples 666 -002 664 rw_rw_r__ [simmsben@opus Directory3]$ umask 0002 [simmsben@opus Directory3]$ rm myfile [simmsben@opus Directory3]$ touch myfile [simmsben@opus Directory3]$ ls -l total 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 -l total 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 -l total 4 -rw-r--r-- 1 simmsben cis90 0 Oct 15 15:00 myfile [simmsben@opus Directory3]$ 666 -000 666 rw_rw_rw_ 666 -022 644 rw_r__r__ /

  24. CIS 90 - Lesson 7 File Permissions exercise - setup /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 Directory1 drwxrwxr-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 -l total 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 /

  25. CIS 90 - Lesson 7 File Permissions exercise – can owner change these files? /home/cis90/simmsben/Directory1 $ ls -l total 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 /

  26. CIS 90 - Lesson 7 File Permissions exercise – can owner change these files? /home/cis90/simmsben/Directory1 $ ls -l total 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 /

  27. CIS 90 - Lesson 7 File Permissions exercise – can owner change these files? /home/cis90/simmsben/Directory1 $ ls -l total 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 /

  28. CIS 90 - Lesson 7 File Permissions exercise – can owner change these files? /home/cis90/simmsben/Directory1 $ ls -l total 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* changes changes blah blah blah /home/cis90/simmsben/Directory1 $ /

  29. CIS 90 - Lesson 7 File Permissions exercise – can group user change these files? [roddyduk@opus Directory1]$ ls -l total 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 /

  30. CIS 90 - Lesson 7 File Permissions exercise – can group user change these files? [roddyduk@opus Directory1]$ ls -l total 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 /

  31. CIS 90 - Lesson 7 File Permissions exercise – can group user change these files? [roddyduk@opus Directory1]$ ls -l total 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 /

  32. CIS 90 - Lesson 7 File Permissions exercise – can group user change these files? [roddyduk@opus Directory1]$ ls -l total 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]$ /

  33. CIS 90 - Lesson 7 File Permissions exercise – can other user change these files? [simmsben@opus Directory1]$ ls -l total 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]$ [simmsmar@opus ~]$ ls -l /home/cis90/simmsben/Directory1 ls: /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 ~]$ /

  34. CIS 90 - Lesson 7 File Permissions exercise – can owner delete these files? [simmsben@opus Directory1]$ ls -ld drwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 . [simmsben@opus Directory1]$ [simmsben@opus Directory1]$ ls -l total 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 file3 rm: remove write-protected regular file `file3'? y [simmsben@opus Directory1]$ /

  35. CIS 90 - Lesson 7 File Permissions exercise – can group user delete these files? [simmsben@opus Directory1]$ ls -ld drwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 . [simmsben@opus Directory1]$ [simmsben@opus Directory1]$ ls -l total 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/file1 rm: cannot remove `../simmsben/Directory1/file1': Permission denied [roddyduk@opus ~]$ rm ../simmsben/Directory1/file2 rm: remove write-protected regular file `../simmsben/Directory1/file2'? y rm: cannot remove `../simmsben/Directory1/file2': Permission denied [roddyduk@opus ~]$ rm ../simmsben/Directory1/file3 rm: remove write-protected regular file `../simmsben/Directory1/file3'? y rm: cannot remove `../simmsben/Directory1/file3': Permission denied [roddyduk@opus ~]$ /

  36. CIS 90 - Lesson 7 File Permissions exercise – can other user delete these files? [simmsben@opus Directory1]$ ls -ld drwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 . [simmsben@opus Directory1]$ [simmsben@opus Directory1]$ ls -l total 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/file1 rm: cannot remove `/home/cis90/simmsben/Directory1/file1': Permission denied [simmsmar@opus ~]$ rm /home/cis90/simmsben/Directory1/file2 rm: cannot remove `/home/cis90/simmsben/Directory1/file2': Permission denied [simmsmar@opus ~]$ rm /home/cis90/simmsben/Directory1/file3 rm: cannot remove `/home/cis90/simmsben/Directory1/file3': Permission denied [simmsmar@opus ~]$ /

  37. CIS 90 - Lesson 7 File Permissions exercise – can owner read these files? [simmsben@opus ~]$ ls Directory1 file1 file2 file3 [simmsben@opus ~]$ cat Directory1/* blah blah blah blah blah blah blah blah blah [simmsben@opus ~]$ /

  38. CIS 90 - Lesson 7 File Permissions exercise – can group user read these files? [simmsben@opus Directory1]$ ls -ld drwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 . [simmsben@opus Directory1]$ [simmsben@opus Directory1]$ ls -l total 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 blah blah blah blah blah blah blah [roddyduk@opus ~]$ /

  39. CIS 90 - Lesson 7 File Permissions exercise – can other user read these files? 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 -ld drwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 . [simmsben@opus Directory1]$ [simmsben@opus Directory1]$ ls -l total 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/file1 cat: /home/cis90/simmsben/Directory1/file1: Permission denied [simmsmar@opus ~]$ cat /home/cis90/simmsben/Directory1/file2 cat: /home/cis90/simmsben/Directory1/file2: Permission denied [simmsmar@opus ~]$ cat /home/cis90/simmsben/Directory1/file3 cat: /home/cis90/simmsben/Directory1/file3: Permission denied [simmsmar@opus ~]$ /

  40. CIS 90 - Lesson 7 File Permissions exercise – can owner execute these files? ==> file1 <== #!/bin/bash echo "blah blah blah" exit 0 ==> file2 <== #!/bin/bash echo "blah blah blah" exit 0 ==> file3 <== #!/bin/bash echo "blah blah blah" exit 0 [simmsben@opus Directory1]$ ls -l total 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]$ ./file2 blah blah blah [simmsben@opus Directory1]$ ./file3 blah blah blah [simmsben@opus Directory1]$ /

  41. CIS 90 - Lesson 7 File Permissions exercise – can group user execute these files? [simmsben@opus Directory1]$ ls -ld drwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 . [simmsben@opus Directory1]$ [simmsben@opus Directory1]$ ls -l total 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/file2 blah blah blah [roddyduk@opus ~]$ /home/cis90/simmsben/Directory1/file3 blah blah blah [roddyduk@opus ~]$ /

  42. CIS 90 - Lesson 7 File Permissions exercise – can other user execute these files? [simmsben@opus ~]$ ls -ld /home/cis90 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 -ld drwxr-x--x 2 simmsben cis90 4096 Oct 15 12:42 . [simmsben@opus Directory1]$ [simmsben@opus Directory1]$ ls -l total 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 ~]$ /

  43. CIS 90 - Lesson 7 Lab 6

  44. CIS 90 - Lesson 7 http://simms-teach.com/docs/cis90/cis90lab6.html

  45. CIS 90 - Lesson 7 Wrap up

  46. CIS 191 - Lesson 7 • New commands: • chgrp change file's group • chmod change file permissions • chown change file owner (superuser only) • umask change permission mask • New Files and Directories: • NA

  47. 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 chmodo+w give write permission to the owner or to other users? Lab 6 Five Posts

  48. CIS 90 - Lesson 7 Backup

More Related