NEXT
$V1$
$V1$
PAGEFLOP
FORWARD
SELECTOR
SELAGAIN
WRONGSEL
YOUR SELECTION IS NOT IN THE 0 - #SELIMIT RANGE Please try again
AANVANG
Copyright CourseWare Technologies Inc., 1985-88
Lesson - 2
FILES AND PROTECTION
MENU
Files and Protection|Topics to Learn|2-0|14,46
# Topic
--- -------
1 - The Hierarchical File System
2 - File Types
3 - Changing File Protection
4 - Changing File Ownership
5 - Lesson Review
0 - Return to the Main Menu
P1
Files and Protection|The Hierarchical File System|2-1.1|11,48
The file system is a uniform set of directories
and files arranged in a tree-like, hierarchical
structure.
Files are grouped into directories and the
directories are organized into a hierarchy.
At the top of the hierarchy is a special
directory called root, with the name /.
P2
Files and Protection|The Hierarchical File System|2-1.2|6,46
A pathname is the complete name of a
directory or a file.
A pathname traces a path through the
file system to the desired file.
P3
Files and Protection|File Types|2-2.1|8,50
UNIX files are classified into 5 types, based
on the way the data is treated.
1. Ordinary Files
2. Directory Files
3. Character Special Files
4. Block Special Files
5. FIFO Files
P4
Files and Protection|File Types|2-2.2|14,70
Ordinary files: executable programs and various system
and user-created data storage files.
Directory files: used by the system to maintain the
hierarchical file structure.
Character special files: used by the system for serial
communication with serial peripherals.
Block Special files: used by the system for parallel
communication with parallel peripherals.
FIFO files: named pipes and are used in UNIX
pipe processes.
P5
Files and Protection|File Types|2-2.3|7,54
The file type may be determined 2 ways:
* by using the file command or
* from the first letter of the file protection
descriptor listed in the output of the ls -l
command.
P6
Files and Protection|File Types|2-2.4|8,52
The file protection descriptor listed by
the ls -l command will be one of the following:
- - Ordinary
d - Directory
c - Character Type
b - Block Type
p - FIFO
l - FIFO
P7
Files and Protection|Changing File Protection|2-3.1|12,56
File protection/privileges and system security are
required for several reasons:
1. to restrict sensitive information to
non-casual, trusted users;
2. to prevent the copying or piracy of
important software; and
3. to prevent inexperienced users from making
changes or executing commands that may have
disastrous effects on their files as well
as the entire system.
P8
Files and Protection|Changing File Protection|2-3.2|15,52
File operations under UNIX are read, write
and execute. These are designated in the file
protection descriptor as:
r - read
w - write
x - execute
A certain type of file operation may be permitted
or disallowed on three levels:
- file owner
- member of owners group
- all others not in owners group
P9
Files and Protection|Changing File Protection|2-3.3|10,50
The first three letters following the file
descriptor type in the file protection descriptor
specify the owner privilege, the next three the
group privilege and the last three the others
privilege.
The letters r , w and x indicate that
privilege is granted and a - indicates that the
corresponding privilege is not granted!
P10
Files and Protection|Changing File Protection|2-3.4|9,48
The file protection descriptor to specify
READ and WRITE privilege for the owner and READ
only for the group and others is:
-rw-r--r--
Only the file owner or a superuser may change
file protection.
P11
Files and Protection|Changing File Protection|2-3.5|10,52
The bits in the file protection descriptor are in
octal notation. Therefore a descriptor such as
rw-r-xr--
has an octal representation of 654 (where r=4, w=2, x=1):
rw- r-x r--
420 401 400
6 5 4
P12
Files and Protection|Changing File Protection|2-3.6|8,54
The command for changing file protection is chmod.
To set READ and WRITE permission for the OWNER,
and READ only for the GROUP and OTHERS for the file
report use:
chmod 644 report
P13
Files and Protection|Changing File Protection|2-3.7|10,54
You can also specify the "relative" mode in a
symbolic way by using the following abbreviations:
u for user (owner) permissions
g for group permissions
o for other permissions
a for all (user, group and others) permissions
= assign a permission
+ add a permission
- remove a permission
P14
Files and Protection|Changing File Protection|2-3.8|16,52
If the file report has permissions -rw-rw-rw-
and you want to remove the write permission from the
GROUP and OTHERS you could use any of the following:
chmod go-w report
OR
chmod a=r,u+w report
OR
chmod u=rw,go=r report
(Remember, you can refer to the list on the previous
screen by paging back with - <CR>.)
P15
Files and Protection|Changing File Ownership|2-4.1|12,56
Unless otherwise changed, the creator of the
file is the owner of the file.
Users in the same group as the owner have group
privileges to the file. The file /etc/group lists
all members of all groups.
Users who have an account on the system but are
not in the same group as the owner of the file have
others privileges to the file.
P16
Files and Protection|Changing File Ownership|2-4.2|14,54
The /etc/chown (for change ownership) command will
change the ownership of a file. The syntax is:
chown newowner filename
To make a user with a login name of jones
the owner of the file summary, the command is:
chown jones summary
Only the owner of a file or a superuser has the
right to change file ownership.