Download presentation
Presentation is loading. Please wait.
1
Permission and CHMOD
2
Beginning Open the website Make directory ”Testing_Directory” In the Testing Directory create four files named Guildford_Park.txt, Presentation.ppt, Word.doc, Excel.xlsx Type: ls –l note the beginning of each file; you will see the following: -rw-r—r-- This tells us the permission that the computer has set for each file.
3
Permissions Permissions are set up in groups of three which creates nine variables. -rwxrwxrwx The first triad indicates what the owner of the computer (or program) can do to a file or directory. The second triad indicates what the user of the computer (or program) can do to a file or directory. The third triad indicates what all/other users of the computer (or program) can do to a file or directory.
4
The RWX characters R – stands the read permission: it grants the ability to read a file. When set for a directory, this permission grants the ability to read the file, but not to find out any further information about them such as contents, file type, size, ownership, permissions. W – stands for the write permission: it grants the ability to read and modify a file. When set for a directory, this permission grants the ability to modify entries in the directory. This includes creating files, deleting files, and renaming files. X – stands for The execute permission: it grants the ability to execute a file (the user must also have read permission). This permission must be set for executable programs, including shell scripts, in order to allow the operating system to run them. When set for a directory, this permission grants the ability to access file contents and meta-information if its name is known.
5
Understanding the Commands
-rwx read, write, & execute only for owner -rwxrwx--- read, write, & execute for owner and user ---x--x—x execute for the owner, user and others -rw-rw-rw- read and write for all, they cannot execute any programs In our situation we have the permissions: -rw-r--r-- read and write for the owner, read only for the user and others
6
Understanding the Commands
The beginning of the three triad’s will either start with a – or a d. The – represents a file and the d represents the directory. Example: drwxr--r-- means the directory you are seeing is read, write and executable by the owner, and read only by the user and all/other users. - rw-rw-rw means the file you are seeing is a read and writable by the owner, user and all/other users. Can we change the permissions?
7
Changing permissions We can change them two ways find a file on your computer, right click your mouse on the file and then select properties (or get info on a Mac). In the properties section you can change the permission of the file(s). However, it is better to make the changes in terminal. Why? You are able to manipulate the executable option, an option that is not allowed by right clicking and opening properties.
8
Changing Permission To change the permission we need to understand that each letter (r,w,x) is represented by a number. R = 4 W = 2 X = 1 Each triad is represented by a number 0, 1, 2, 3, 4, 5, 6, or 7 Thus a permission of –rwx = 700 (since r+w+x is and since there is only one set of triad defined, the other two parts of the triade are and each of them equals 0) Permission -rw-rw-rw = 666 (since r+w is 6, and we have three rw, thus we have 666) Permission drwxrw-r-- =764 (since r+w+x is 7, r+w is 6 and r is 4, we have 764)
9
Changing permissions To change a permission in terminal, use the command ‘chmod’ Lets turn our files into a rwx for owner, user and all/other users. Type: chmod 777 Guildford_Park.txt, Presentation.ppt, Word.doc, Excel.xlsx Type: ls –l We will now see that all our files are rwx for owner, user and all/other users.
10
Assignment Solve the following permissions by identifying the value for each permission line Example: -rwxrwxrwx 777; it is a file and 7 for the owner, 7 for the user and 7 for all/other users -rw-rw- - -x -r-xr-xr-x drwxr - - r - - d-wx--wx-wx
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.