Download presentation
Presentation is loading. Please wait.
Published byLambert Morton Modified over 9 years ago
1
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2011 by the Trustees of Indiana University except as noted
2
Section Overview File types File attributes and ownership Changing access permissions Special attributes Searching the filesystem
3
References CQU 85321 System Administration Course Chapter 5
4
Types of Files Regular Files Directories Devices Character Devices Block Devices Sockets and Named Pipes Symbolic Links
5
Files and Directories Everything is referenced via a file Directories List of files & inodes “.” – Reference to the current directory “..” – Reference to parent directory Root ( / ) – “.” and “..” are the same
6
Device Files Character Devices Transfer unit: byte Example: /dev/console Block Devices Transfer unit: Group of bytes (block) Examples: /dev/hda Device Numbers Major – Type of device Minor – Device number
7
Sockets & Named Pipes Enables communication between processes Socket Processed must have a connection first Example: X Windows Named Pipe Communication between unrelated processes FIFO Not used very often
8
Link Files Multiple names for same file Hard Link Pointer to Inode Can’t cross partitions File removed when all links deleted Symbolic (Soft) Links Pointer to file path name Dangling symlink – Real file which no longer exists ln [-s]
9
Magic Numbers Byte pattern at beginning of file Patterns listed in file called magic RedHat: /usr/share/magic file – Tests a file to determine type Filesystem Test Magic Number Test Language Test
10
Access Control Model SubjectOSReferenceMonitorObjectAccessrequestAccessGranted
11
MS File/Directory Attributes Read-Only Hidden System Archive
12
UNIX/Linux File Attributes Inode Permissions Ownership Time Stamps Change Modification Access File Size Link Count Pointers to data
13
Viewing File Attributes File Type Permissions Link Count Ownership File Size/Device # Modification Date File Name ls –l : Long listing (includes attributes) stat : Lists all attributes
14
File Type Attribute # ls -ld /home /etc/passwd /dev/console crw--w--w- 1 root root 5, 1 Sep 27 11:27 /dev/console -rw-r--r-- 1 root root 559 Sep 22 13:14 /etc/passwd drwxr-xr-x 3 root root 0 Sep 26 10:42 /home File Type Meaning - Regular File d Directory l Symbolic Link b Block Device c Character Device p Named Pipe s Domain Socket
15
Ownership User Owner of file User names/UIDs defined in /etc/passwd Group Organization of users accessing the file Group names/GIDs defined in /etc/group # ls -ld /home /etc/passwd /dev/console crw--w--w- 1 root root 5, 1 Sep 27 11:27 /dev/console -rw-r--r-- 1 root root 559 Sep 22 13:14 /etc/passwd drwxr-xr-x 3 root root 0 Sep 26 10:42 /home
16
Permissions 3 levels of access – Owner, Group, Other # ls -ld /home /etc/passwd /dev/console crw--w--w- 1 root root 5, 1 Sep 27 11:27 /dev/console -rw-r--r-- 1 root root 559 Sep 22 13:14 /etc/passwd drwxr-xr-x 3 root root 0 Sep 26 10:42 /home OperationFileDirectory ReadRead fileList files WriteDelete/Modify fileCreate/Delete file ExecuteRun programAccess file
17
Changing Access Users & Groups chown [-R] user file… chgrp [-R] group file Permissions chmod [-R] file… Numeric: = [#]### Symbolic: = Who: (u)ser (g)roup (o)ther (a)ll op: (+)add (-)remove (=)set Perm: (r)ead (w)rite e(x)ecute
18
Numeric/Symbolic Permissions OctalBinarySymbolic 0000 --- 1001 --x 2010 -w- 3011 -wx 4100 r-- 5101 r-x 6110 rw- 7111 rwx
19
Default Permissions umask Shell Environment Variable Defines permissions to remove NumericBinary Effective Perms 0000 rwx 1001 rw- 2010 r-w 3011 r-- 4100 -wx 5101 -w- 6110 --x 7111 ---
20
Special Attributes Setuid (SUID) Bit Run program with access of owner Symbolic: s Numeric: 4000 Setgid (SGID) Bit Run program with access of owner group Symbolic: s Numeric: 2000
21
Sticky Bit Purpose File: Force program to stay in RAM (obsolete) Directory: Cannot remove file unless you own the file or directory Symbolic: t Numeric: 1000 Example: /tmp
22
Microsoft Permissions Read Create Write Append Delete Execute Search Ownership Access Control GUI and CLI (i cacls ) tools to manage Denials and effective permissions
23
Default Permissions? Linux/Mac Predefined default (users can change) umask Microsoft Inherited from parent directory Can disable
24
Group Access Users requiring same access to object Simplifies adding/removing of access Adding/Removing users Adding/removing permissions to object Multiple group membership interaction Union Interception Deny permissions
25
Searching the Filesystem find : Command line search tool Searches through directory hierarchy Search by any combination of file names and attributes Display files or perform operations on them Examples: find /var –mtime -1 find / -name core –exec rm –f {} \;
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.