linux file permissions
play

Linux File Permissions Engineering Secure Software Last Revised: - PowerPoint PPT Presentation

Linux File Permissions Engineering Secure Software Last Revised: August 26, 2020 SWEN-331: Engineering Secure Software Benjamin S Meyers 1 Review: Principle of Least Privilege Every user, thread, process, module needs permissions to run


  1. Linux File Permissions Engineering Secure Software Last Revised: August 26, 2020 SWEN-331: Engineering Secure Software Benjamin S Meyers 1

  2. Review: Principle of Least Privilege Every user, thread, process, module needs permissions to run ● Give the least amount of privilege necessary to function ● Dangers of sudo ● e.g. secretary vs. custodian vs. salesperson vs. developer ● SWEN-331: Engineering Secure Software Benjamin S Meyers 2

  3. Linux File Permissions Each file and directory has bits for: ● Read: r ○ Write: w ○ Execute: x ○ Bits work like you expect for files ● For directories: ● r → “can list files in a directory” (but not read a given file) ○ w → “can create, change, delete files in a directory” ○ x → “cannot cd (change directory) to that directory” ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 3

  4. Linux File Permissions Thus, you may only read a file IFF you: ● Have read ( r ) permissions to the file AND ○ Have execute ( x ) permissions to that file’s directory ○ Files and directories have 3 levels of permissions: ● Owner, Group, and Everyone Else ○ aka: User ( u ), Group ( g ), Other ( o ) ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 4

  5. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb SWEN-331: Engineering Secure Software Benjamin S Meyers 5

  6. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb . (one dot) → current directory ● .. (two dots) → parent directory ● SWEN-331: Engineering Secure Software Benjamin S Meyers 6

  7. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb d → directory ● - → regular file ● l → symlink (that’s a lowercase “L”, not the number “1”) ● SWEN-331: Engineering Secure Software Benjamin S Meyers 7

  8. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb Octets ● user/owner permissions ○ group permissions ○ other permissions ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 8

  9. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb Can andy execute myprog.py ? ● SWEN-331: Engineering Secure Software Benjamin S Meyers 9

  10. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb Can andy execute myprog.py ? ● No, andy is not the owner of myprog.py , and the faculty group ○ (which andy is a member of) does not have permission to execute ( x ) myprog.py SWEN-331: Engineering Secure Software Benjamin S Meyers 10 10

  11. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb Can both kal and andy execute ourprog.rb ? ● SWEN-331: Engineering Secure Software Benjamin S Meyers 11 11

  12. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb Can both kal and andy execute ourprog.rb ? ● Yes, everyone in the faculty group can execute ( x ) ourprog.rb ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 12 12

  13. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb Can andy read ourprog.rb ? ● SWEN-331: Engineering Secure Software Benjamin S Meyers 13 13

  14. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb Can andy read ourprog.rb ? ● Yes, because andy has read ( r ) permissions to the ourprog.rb ○ and execute ( x ) permissions to ourprog.rb ’s parent directory SWEN-331: Engineering Secure Software Benjamin S Meyers 14 14

  15. Output of ls List permissions of a file/directory: ls -l ● permissions user group file/dir name drwxr-x--- [...] kal faculty [...] . drwx------ [...] kal faculty [...] .. -rwxrwxrwx [...] kal faculty [...] allopen.sh drwx------ [...] kal faculty [...] mydir -rw------- [...] kal faculty [...] myfile.txt -rwx------ [...] kal faculty [...] myprog.py drwxrwx--- [...] kal faculty [...] ourdir -rwxrwx--- [...] andy faculty [...] ourprog.rb Can andy change directory ( cd ) into mydir ? ● SWEN-331: Engineering Secure Software Benjamin S Meyers 15 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend