Engineering Secure Software. Linux File Permissions  Each file and directory has bits for.. Read, Write, Execute: rwx Files: works as it sounds  Directories:

Slides:



Advertisements
Similar presentations
Linux File & Folder permissions. File Permissions In Ubuntu, files and folders can be set up so that only specific users can view, modify, or run them.
Advertisements

File Security. Viewing Permissions ls –l Permission Values.
File security and Permissions A file is owned by the user who created it That user can then specify who can read, write and execute that file A file when.
Linux+ Guide to Linux Certification, Second Edition
CS 497C – Introduction to UNIX Lecture 15: - File Attributes Chin-Chih Chang
Linux Linux File System.
UNIX Chapter 08 File Security Mr. Mohammad Smirat.
LERSAIS.  Access Control in Unix  Access Control in Windows  Port Redirection 2.
Using Linux Commands Lab 4. Using the Shell in Linux Commands Syntax  Options: could be added to the commands to change their behavior (-a, -la, --help)
Getting Started with Linux Linux System Administration Permissions.
File System Security 1. General Principles Files and folders are managed by the operating system Applications, including shells, access files through.
Chapter 3.3: Filesystem Security 1. General Definitions Files and folders (directories) are managed by the operating system Applications, including shells,
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
Linux+ Guide to Linux Certification, Second Edition
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2011 by the Trustees of Indiana University except as noted.
Module 4 - File Security. Security Overview File Ownership Access to Files and Dircetories Changing File and Directory Ownership Changing File and Directory.
File Permission and Access. Module 6 File Permission and Access ♦ Introduction Linux is a multi-user system where users can assign different access permission.
Chapter 3 Some additional notes… File permissions A file has three types of permissions (read, write and execute). Available to three categories of users.
File Security and Permissions. File Permissions (1) u With respect to a particular file, Unix divides the set of all users on a system into three categories:
Chapter 4: File Security & Permissions Also: Hard and Soft Links, see p77-80 &
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
PacNOG 6: Nadi, Fiji UNIX ™/ /Linux Permissions Hervey Allen Network Startup Resource Center.
Privileges: who can control what Introduction to Unix June 16, 2009 Papeete, French Polynesia Hervey Allen.
Privileges: who can control what Introduction to Unix May 24, 2008 Rabat, Morocco Hervey Allen.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2007 by the Trustees of Indiana University except as noted.
Using Linux Commands Lab 4. Using the Shell in Linux Commands Syntax  Options: could be added to the commands to change their behavior (-a, -la, --help)
Chapter 8 File System Security. File Protection Schemes Login passwords Encryption File Access Privileges.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 5 File.
File Systems, telnet and ftp Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX.
CSCI 330 The UNIX System Unit V Permissions. all access to directories and files is controlled UNIX uses discretionary access control (DAC) model each.
Chapter 8 File System Security. File Protection Schemes Password-Based Protection Encryption-Based Protection Protection-Based on Access Permission.
Intro. To Unix commands For those who’ve never used Unix before Quick tutorial to let you move around your Unix Accounts No discussion of inner workings.
File System Security ls -l. First Columm d = directory l = symbolic link b = block special file c = character special file p = fifo (or named pipe) special.
1 File Permissions Look at permissions with ls -l Output: –-rw-r--r-- 1 enda users 1234 Jun 2 10:51 file.ext.
Agenda The Linux File System (chapter 4 in text) Setting Access Permissions Directory vs File Permissions chmod Utility Symbolic Method Absolute Method.
Jozef Goetz, expanded by Jozef Goetz, 2008 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
BIF703 File Permissions. As you recall from our previous notes, that Unix/Linux recognizes everything as a file: Regular files to store data, programs,
Chapter 2: Exploring the UNIX File System (For Tuesday Section) File and File Systems.
File System Security in Unix Annie Calpe. Overview Unix Basics File System Security: - Account Security: Passwords - File Permissions - Access Control.
Linux Permissions ● Meryll Larkin - that's me ● Why you are here: – You do this at work or want to – General curiosity - want to learn – Your first choice.
Linux Filesystem Management
Privileges: who can control what
Permissions: who can control what Unix/IP Preparation Course July 19, 2009 Eugene, Oregon, USA
Introduction to Unix – CS 21
File permissions Operating systems I800
Chapter 3 Maintaining Security
Chapter 8 File Security.
BIF703 File Permissions.
Privileges: who can control what
Using Linux Commands Lab 3.
Chapter 7 File and file System structure
Presented by, Mr. Satish Pise
Security and File Permission
Persistent shell settings; users/groups; permissions
Engineering Secure Software
The Linux Command Line Chapter 9
Persistent shell settings; users/groups; permissions
Persistent shell settings; users/groups; permissions
Agenda The Linux File System (chapter 4 in text)
Persistent shell settings; users/groups; permissions
Persistent shell settings; users/groups; permissions
In the last class,. ls –l command. seven fields
Engineering Secure Software
FILE SECURITY AND ACCESS CONTROL
Figure 6-13: Managing Permissions
In the last class, The concept of file system
Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel
Presentation transcript:

Engineering Secure Software

Linux File Permissions  Each file and directory has bits for.. Read, Write, Execute: rwx Files: works as it sounds  Directories: r  “can list files in a directory” (but not read a given file) x  “read a file if you know the name” (easy if directory also has read) w  “can create, change, delete files in directory”  Thus, you may only read a file IFF you: Have read permissions to the file AND Have execute permissions to that file’s directory  Files & Directories have 3 levels: Owner, Group, and Everyone Else aka. User, Group, Other: ugo

 List permissions of a file: ls –l with some info removed from below in [...] drwx--x--- […] andy faculty […]. drwx […] andy faculty […].. -rwxrwxrwx […] andy faculty […] allopen drwx […] andy faculty […] mydir -rw […] andy faculty […] myfile -rwx […] andy faculty […] myprog drwxrwx--- […] andy faculty […] ourdir -rwxrwx--- […] kenn faculty […] ourprog  Can kenn execute myprog ? No, because of file permissions.  Can both andy and kenn execute ourprog ? Yes. Everyone in faculty can read and execute ourprog  Can kenn read ourprog ? Yes. Directory has group x, file has group r  Can kenn list to find ourprog ? No. Directory listing is off.

chmod  Command to change permissions Set (=), Add (+), Remove (-) Set user to rw, not x: chmod u=rw. Set user, groups to only rw: chmod ug=rw. Set ug to only rx, recursively: chmod –R ug=rx. Add “groups can rw”: chmod g+rw. Add “others can rw”: chmod o+rw. Add “everyone can read”: chmod a+r. Remove write from group: chmod g-w.  Octal notation e.g. chmod 755 file.txt Good for setting, not adding/removing 1,2,3 are never used rwx-----x-w--wxr--r-xrw-rwx Binary Decimal

umask  When a file is created… User mask ( umask ) is consulted for permissions Owner = user who created the file Subtract octally ○ from 666 for files ○ from 777 for directories ○ e.g =644, or rw-r--r-- nitron.se.rit.edu default: rw ( or 077 ) Common default: rw-r--r– ( or 022 ) Common umask shared group stuff: rw-rw--– ( or 007 )  Programs can change their own umask Blessing for good developers Curse for system administrators

setuid, setgid  When executing, ordinarily… OS ignores the owner of the program Runs the program as you (assuming you have permissions, of course) e.g. prog.sh owned by root gets run as you  setuid and setgid bits on files chmod ug+s./prog.sh “If you can execute this, it’s executed as the owner’s rights, not as the executing user’s rights” Files owned by root should never have this set Different from the “sticky bit” (not covered here)  setuid and setgid bits on directories setuid on directories is ignored in Linux setgid means new files inherit the group ID (like umask)

For Example larry$ umask 077 larry$ mkdir dir larry$ ls –l dir/ drwx … larry stooges … dir larry$ touch dir/file.sh larry$ ls –la dir/ -rwx … larry stooges …. [./dir] -rwx … larry stooges ….. [./dir/..] -rw … larry stooges … file.sh larry$./dir/file.sh bash:./dir/file.sh: Permission denied larry$ chmod –R ug+x. curly$./dir/file.sh [Success!] curly$ ls –l./dir bash:./dir/: Permission denied

Beware of sudo  He sees you when you're sleeping, he knows when you're awake, he's copied on /var/spool/mail/root, so be good for goodness' sake.  Source: