Download presentation
Presentation is loading. Please wait.
Published byVirgil Baker Modified over 9 years ago
1
Revision: Absolute and relative paths
2
(root) staffusrbinstudetc ResearchTeachingPrivate pgugitmasters xxxgtrxxx CUA Coursework1.txt CUA xxx02uxxx04u MVR Lecture1.ppt Lecture2.doc.profile The filestore
3
Absolute and Relative Pathnames There are two ways of specifying filenames –from the current directory - relative pathnames –from the root directory - absolute pathnames Simple pathnames consist of sequences of names separated by ‘/’ characters An example of a relative pathname:../myDoc.txt An example of an absolute pathname: /stud/ug/xxx04u/Documents/myDoc.txt
4
Special symbols Special symbols can be used in pathnames..the directory one level above this../.. the directory two levels above this. the current directory ~this user’s home directory ~usera specific user’s home directory
5
Where am I in the File Structure? pwd prints the pathname of the current working directory cd pathname changes current directory –with no argument it goes to the home directory
6
Where am I in the File Structure? (2) robin$ pwd /stud/ug/xxx04u robin$ cd UST robin$ pwd /stud/ug/xxx04u/UST robin$ pwd /stud/ug/xxx04u/UST robin$ cd.. robin$ pwd /stud/ug/xxx04u/ (root) staffusrbinstudetc ResearchTeachingPrivate pgugitmasters xxxgtrxxx CUA Coursework1.txt UST xxx02uxxx04u MVR Lecture1.ppt Lecture2.doc.profile
7
Exercises Is ~ an absolute path? Suppose the working directory is /home/domain/zlizta/ and one enters the command cd../../media/../usr/./games/ What is the new working directory?
8
Relative and Absolute Pathnames Revisited (root) staffusrbinstudetc ResearchTeachingPrivate pgugitmasters xxxgtrxxx CUA Coursework1.txt CUA xxx02uxxx04u MVR Lecture1.ppt Lecture2.doc.profile /../../../stud You are here! /stud/ug/xxx04u.. /stud/ug../..../../../.. ~~xxx04u RelativeAbsolute./stud/ug/xxx04u/CUA
9
The Unix file sytem: file permissions
10
Security and file permissions A shared filestore needs a security mechanism to prevent the unauthorised reading and writing of files UNIX associates a permissions list with each file saying who can do what to it Each directory also has a permissions list How you can access a file depends upon its permissions list and those of all its parent directories
11
Permissions lists Specify who can do what There are three kinds of who: uthe user (owner) gmembers of the file’s group oothers - anyone else There are three kinds of what: rread wwrite xexecute
12
Permissions lists (2) Use ls -l to see permissions lists drwxr--r-- 1 gtr staff 173568 Sep 21 15:41 Labs drwxr--r-- 1 gtr staff 202752 Sep 21 17:43 Lectures -rw-r--r-- 1 gtr staff 2638848 Oct 6 18:58 Outline.doc -rw-r----- 1 gtr staff 87552 Oct 6 18:19 Intro.ppt
13
Permissions lists (3) Each permissions list is shown as ten characters:
14
Group’s permissions (read only) User’s permissions (read, write and execute) Others’ permissions (read only) File/Directory name File size Group that user is in User Date file was last modified/created Directory -rwxr--r-- 1 gtr staff 5173568 Sep 21 15:41 cve_user drwxr--r-- 1 gtr staff 202752 Sep 21 17:43 Reports -rw-r--r-- 1 gtr staff 2638848 Oct 6 18:58 Yr1Report.doc -rwxr--r-- 1 gtr staff 5587552 Oct 6 18:19 plod_node_mgr
15
The effect of directory permissions Execute lets you change (cd) into that directory –(i.e. you are searching the directory) Read lets you list files in the directory –(i.e. you are reading the directory contents) Write lets you create and delete files –(i.e. you are writing to the directory contents) To use a file at all you must have execute permission on all of its parents (otherwise it is as if it doesn’t exist)
16
other parents up to the root file parent directory execute permission controls whether any files and directories below this point can be accessed at all permissions control whether files can be accessed at all, listed, created and deleted permissions control specific actions on this file
17
Setting and changing permissions -chmod chmod mode pathname is used to alter permissions lists Mode specifies a sequence of changes, each of the form who operation permission –who is u, g or o –operation is + (grant) or - (revoke) –permission is r, w or x Examples: chmod o-r g-r plan.doc chmod u+rwx Admin
18
The mode can also be a three digit octal number that is interpreted as a sequence of nine bits to set the whole permissions list at once: –chmod 644 progress.txt 644 is 110 100 100 which is interpreted as rw- r-- r-- –chmod 777 progress.txt 777 is 111 111 111 which is interpreted rwx rwx rwx –chmod 400 progress.txt 400 is 100 000 000 which is interpreted as r-- --- --- Setting and changing permissions – chmod (2)
19
Next Lecture (Simple) Regular Expressions and Searching files Redirecting output
20
Summary The UNIX filestore Pathnames Security and file permissions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.