Download UNIX Operating System

Document related concepts
no text concepts found
Transcript
Agenda
Administrative Issues
Link of the Week
This Week’s Expected Outcomes
Points of interest
Moving around in UNIX
Break-Out Problems
Upcoming Deadlines
Hands-on Information
Lab Assistance, Questions, and Answers
Announcements
Announcements
Students are encouraged to email their
Power Point presentations to me at least three
hour prior to the class presentation session. This
allows me the opportunity to open your Power
Point file and verify that it is usable.
Link of the week
HTML Tutorial
http://www.w3schools.com
Purchase CGI scripts
http://www.cgiscript.net
"How to Create Your Own Home Page" Home Page
http://www.intergalact.com/hp/part3/part3.html
CGI Programming FAQ by Nick Kews
http://www.webthing.com/tutorials/cgifaq.html
Introduction to CGI Scripts
http://linux.die.net/man/3/cgi
Link of the week
What does CGI stand for?
Common in the sense that there are many
programming languages that scripts can be written in
and interact with different types of systems. The user
isn’t limited to just one way.
Gateway in strengths that lie in not only what it can
do itself, but with it’s potential access it offers to other
systems (databases/graphic generators).
Interface that provides a well-defined way to call
up its features. The interface between the CGI script
and the Web server is fixed.
Link of the week
CGI Scripts
CGI is the standard for interfacing with external
applications and information servers. The information
servers can be HTTP or Web servers. The CGI scripts
provide a more dynamic avenue for information servers
to pursue rather than as a HTML file server.
Link of the week
CGI Scripts
Link of the week
PROCESS STATE CODES (man ps command)
D uninterruptible sleep (usually IO)
R runable (on run queue)
S sleeping
T traced or stopped
Z a defunct ("zombie") process. Defunct ("zombie")
process, terminated but not reaped by it’s parent.
For BSD formats and when the “STAT" keyword is used,
additional letters may be displayed:
W
<
N
L
has no resident pages
high-priority process
low-priority task
has pages locked into memory (for real-time and custom
IO)
Link of the week
PROCESS STATE CODES (man ps command)
For BSD formats and when the stat keyword is used,
additional characters may be displayed:
< high-priority (not nice to other users)
N low-priority (nice to other users)
L has pages locked into memory (for real-time and
custom IO)
s is a session leader
l is multi-threaded (using CLONE_THREAD, like
NPTL threads do)
+ is in the foreground process group
Link of the week
PROCESS STATE CODES (man ps command)
Use the ps -aux | less command to display
the above mentioned codes listed under the
STAT column heading.
Link of the week
PROCESS STATE Code
/export/home/dandrear> ps –aux
USER
root
root
root
root
root
root
root
root
root
root
PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
1
0.0
0.0 1424 488 ?
S
Oct19 0:24 init
2
0.0
0.0
0 0?
SW Oct19
0:00 [migration/0]
3
0.0
0.0
0 0?
SW Oct19
0:00 [migration/1]
4
0.0
0.0
0 0?
SW Oct19
0:00 [migration/2]
5
0.0
0.0
0 0?
SW Oct19
0:00 [migration/3]
6
0.0
0.0
0 0?
SW Oct19 0:00 [keventd]
7
0.0
0.0
0 0?
SWN Oct19 0:00 [ksoftirqd/0]
8
0.0
0.0
0 0?
SWN Oct19 0:00 [ksoftirqd/1]
9
0.0
0.0
0 0?
SWN Oct19 0:00 [ksoftirqd/2]
10
0.0
0.0
0
0?
SWN Oct19
0:00 [ksoftirqd/3]
VSZ – virtual memory usage of the entire process.
RSS – non-swapped physical memory that a task has
used.
Link of the week
PROCESS STATE Code
/export/home/dandrear>ps –aux | less
USER PID %CPU %MEM
root
26 0.0
0.0
root
27 0.0
0.0
root
28 0.0
0.0
root
401 0.0 0.0
root
612 0.0 0.0
dandrear 20749 0.0 0.0
dandrear 20750 0.0 0.0
VSZ RSS TTY
0 0
?
0 0
?
0 0
?
2428 8
?
0 0
?
4812 1036 pts/0
4448 784 pts/0
STAT START TIME COMMAND
S
2011 4:19
[kswapd0]
SN
2011 0:00
[ksmd]
S
2011 0:00
[aio/0]
S<s
2011 0:00 /sbin/udevd -d
S
2011 0:00
[vmmemctl]
R+
20:23 0:00
ps -aux
S+
20:23 0:00
less
This Week’s Expected Outcomes
What information are we covering?
Upon successful completion of this module, the
student will be able to:
Fsck utility
lost+found directory
Describe the structure and use of Web servers.
Create and run CGI scripts.
Evaluate a current Web technology project.
Review PATA, SATA, and SCSI disks technology
Purpose of partitions
UNIX Operating System
What function does the lost+found directory
provide?
Fsck is a utility that checks and repairs files.
Fsck, tries to locate fragments of files that are not
referenced anywhere in the filesystem. In particular,
fsck might find data that looks like a complete file,
but does not have a name anywhere on the system or
an inode with a corresponding file name. This data is
considered garbage because it is still occupying disk
space, and is not accessible by normal means.
When fsck is executed to repair a filesystem, it
turns almost deleted files back into files. The file
with the missing name and location use to exist in the
filesystem, but the information is no longer available.
UNIX Operating System
What function does the lost+found directory
provide?
During execution, fsck deposits the file in the
lost+found directory. The file was once lost and now
it has been found.
UNIX Operating System
What function does the lost+found directory
provide?
Usually, there is one directory in every disk
partition. Disk errors or incorrect system shutdowns
cause files to become lost. This is the directory they
can be found in.
UNIX Operating System
What function does the lost+found directory
provide?
Files that appear in lost+found are typically files
that were already unlinked (i.e. their name had been
erased) but still opened by some process (so the data
wasn't erased yet) when the system halted suddenly
(kernel panic or power failure). If that's all that
happened, these files were slated for deletion anyway,
you don't need to care about them.
UNIX Operating System
What function does the lost+found directory
provide?
Files can also appear in the
lost+found directory because the
filesystem was in an inconsistent state
due to a software or hardware bug. If
that's the case, it's a way for you to find
files that were lost but that the system
repair managed to salvage. The files may
or may not contain useful data, and even
if they do they may be incomplete or out
of date; it all depends how bad the
filesystem damage was.
UNIX Operating System
What function does the lost+found directory
provide?
On many filesystems, the lost+found directory
is a bit special because it preallocates a bit of space
for fsck to deposit files there. (The space isn't for the
file data, which fsck leaves in place; it's for the
directory entries which fsck has to make up.) If you
accidentally delete lost+found, don't re-create it
with mkdir, use mklost+found command if available
on your system.
UNIX Operating System
The MD5 Message-Digest algorithm is a popular
crytographic hash function that produces a 128 bit
hash value, typically represented in a text format as a
32 digit hexadecimal number.
In recent times, a flaw was found in the design of
MD5. While the flaw was not considered
catastrophic, it was shown that MD5 is not collision
resistant. MD5 is not suitable for applications like
SSL certificates or digital signatures, which rely on
this property of digital security.
UNIX Operating System
One-Way Encryption (Message Digest 5)
1. MD5 encrypted password (option secret 0)
2. MD5 encryption text string (option secret 5)
The optional 0 keyword enables MD5
encryption on a clear text password; the 5
keyword enters an MD5 encryption string and
saves it as the user MD5-encrypted secret.
MD5 encryption is a strong encryption method
which is not retrievable; thus, you cannot use
MD5 encryption with protocols that require
clear text passwords, such as CHAP
UNIX Operating System
One-Way Encryption (Message Digest 5)
MD5 encryption is a one way hash encryption
algorithm and cannot be decrypted (except by brute
force). MD5 encryption can be compromised using
brute force on it. Rainbow tables use a mathematic
algorithm so its easier and faster than a common
brute force.
And yes, there are tables which can crack MD5. If a
password is bigger than 15 characters, it takes a
hacker more time to create the conditions necessary
to compromise the password.
So, if your password is bigger than 15 characters your
level of security is considered safe.
UNIX Operating System
Super Block Attributes
Contains information about each mounted file
system.
The super-block is the first block of each
ext2FS/ext3FS partition. It contains important data
about the file system, such as its size, free space, etc.
(it is similar to the method used by FAT partitions). A
partition with a damaged super-block cannot be
mounted. Fortunately, ext2FS/ext3FS keeps several
super-block backup copies scattered over the
partition.
Most of the information stored in the super-block
is considered static. Static information can be critical
in recovering data.
UNIX Operating System
ext3 File System
Super Block
File Manager
Linux Virtual File System
Kernel
UNIX Operating System
Linux Virtual File System (VFS)
The purpose of a VFS is to allow client
applications to access different types of file systems
in a uniform way.
Manages kernel file abstractions in one format
for all file systems.
Receive system call requests from user level
(e.g. write, open, stat, link).
Interacts with a specific file system based on the
mount point traversal
Receive requests from other parts of the kernel,
mostly from memory management.
UNIX Operating System
File Manager
The file manager is a program that
provides a user interface to work with the
file system. They are very useful for
speeding up interaction with files. The
most common operations on files are
create, open, edit, print, rename, move,
and copy
UNIX Operating System
LDAP (Lightweight Directory Access
Protocol ):
A set of protocols for accessing
information directories. LDAP is considered
the simplified version of the X-500 standard.
Unlike the X-500 standard, LDAP supports
TCP/IP for Internet access.
UNIX Operating System
LDAP Characteristics
• Relatively Static Data - the data is rarely modified.
How often do you change your telephone number?
• Extremely Fast Read Operations - the directory is
tuned for high read performance because the data in
the directory is frequently read and rarely written or
updated.
• Distributed - the data is located on a number of
systems on the network for redundancy, performance,
and scalability.
• Hierarchical -This ensures there is an authoritative
source of the data in the directory system.
UNIX Operating System
Apache Web Server
Apache Web server is free and distributed as source
files by the Apache Software Foundation.
Apache is generally recognized as the world's most
popular Web server (HTTP server). Originally
designed for UNIX servers, the Apache Web server
has been ported to Windows and other network
operating systems. The name "Apache" derives from
the word "patchy" that the Apache developers used to
describe early versions of their software.
apache 31748 27504 0 Mar23 ?
/usr/sbin/httpd
00:00:03
UNIX Operating System
Describe the structure and use of Web
servers.
Early Web sites consisted of HTML pages that
could only provide data that was written into
the HTML page itself. This was sufficient for
that time frame.
Currently, Web sites provide dynamic data
into an HTML page with the use of CGI
scripts.
It is a mechanism for a Web server to be able
to interact with an external program. These
external programs are CGI scripts.
UNIX Operating System
Describe the structure and use of Web
servers.
CGI scripts can be written in any programming
languages. Perl is the common choice because
of its feature richness.
The web is composed of clients and servers.
CGI is used on the server to provide additional
services and functionality to the client.
UNIX Operating System
The Apache HTTP server must be instructed to
locate the CGI scripts.
Two more pieces of information are needed.
1) A program in that directory to be used as a CGI script.
2) A link in an HTML page to your CGI script.
The CGI script itself simply produces output to stdout. The
HTTP server captures that output and sends it to the Web
browser. The format of the output must be in a form that the
Web browser can understand (HTML).
The CGI script creates the HTML page every time it is
run.
The data provided to the HTML page can change with each
execution of the script. The Web browser reports data
dynamically to the user.
UNIX Operating System
URL that points to the CGI script.
http://cs.franklin.edu/~dandrear/itec400/CGI/s
ysInfo.cgi
Apache Web Server
A user can test from a Web browser on the
same machine using the host name
“localhost.” http://localhost will try to find a
Web server on the same machine as the Web
browser.
UNIX Operating System
Hard Disks
Hard disks are among the most important
components in your system.
There are three hard disks interfaces on
most computers
1. Parallel Advanced Technology Attachment
(PATA)
2. Serial Advanced Technology Attachment
(SATA)
3. Small Computer System Interface (SCSI).
UNIX Operating System
Configuring PATA Disks
PATA disks were once the dominate player
in the x86 PC world. Since 2005, PATA still
exists, but in the shadows of years past. PATA
disks are still available.
UNIX Operating System
Configuring PATA Disks
PATA is a parallel interface, which means that
several bits of data are transferred over the cable at one
time. PATA cables are thick/wide, because they support
40 to 80 lines, depending on the variety of PATA. The
PAPA ribbon cable contains three connectors. One
connector connects to the motherboard, and the other
two connect to disk devices.
PATA disks are connected as masters or as slaves.
This is typically done with jumpers on the physical
disks themselves. The master devices are located at the
ends of the cable, and the slave device resided on the
middle connector.
UNIX Operating System
UNIX Operating System
Disk performance
Disks should be connected to separate
controllers rather than configured as slave and
master on the same single controller, because
each PATA controller has a limited throughput
that may be exceeded by two drives. Today,
most motherboards have at least two controllers,
so putting each drive on its own controller is
more efficient.
PATA transfer rate is 128-1064 Mbps
UNIX Operating System
SATA disks
SATA disks are newer than PATA
disks. The SATA disks connect to the
motherboards or controllers on a oneto-one basis. SATA disks do not use
jumpers.
SATA is a serial bus, which transfers
one bit of data at a time and is faster
that PATA data transfers. The size of a
SATA cable is much smaller than a
PATA cable.
UNIX Operating System
SATA disks
Modern firmware detects the
presence of SATA disks just as it did for
PATA disks. The firmware may provide
boot up options. This could be true if
the motherboard does not provide
SATA support but you use a separate
SATA controller card. It is possible to
boot from a SATA disk in such cases if
your controller card supports this option
or you might have to used the PATA
boot disk.
UNIX Operating System
Configuring SATA Disks
In most cases, Linux SATA drivers treat
SATA disks as if they were SCSI. Some
older drivers treat SATA disks like PATA
disks, so you need to use PATA names on
some occasions.
UNIX Operating System
SATA performance
SATA transfer rate 1.5 – 6.0Gbps
UNIX Operating System
Configuring SCSI disks
SCSI disks are available in a variety
of flavors. SCSI cables come in different
sizes and operate at different speeds.
Traditionally, SCSI has been a parallel
bus, like PATA although the latest variant
is a serial bus like SATA. Although, SCSI
is considered a superior bus compared to
PATA, it cost difference has risen
dramatically in the past few years, which
has affected their sales.
UNIX Operating System
Configuring SCSI Disks
SCSI supports as many as 8 to 16
devices per bus, depending on the variant
release. In practice, the number of
devices you can attach to a SCSI bus is
more restricted because of cable length
limits, which vary from one SCSI variant
to another. Each device has it’s own ID
number, To set the ID, consult the
associated documentation.
UNIX Operating System
Configuring SCSI Disks
The SCSI bus is logically just one
dimension. That means that every device on the
bus falls along a single line. The bus is straight
for all practical purposes. Each end of the SCSI
bus must be terminated. This is performed by
including a special resistor pack that prevents
signals from bouncing back and forth along the
SCSI chain. Termination is a hardware
requirement, it doesn’t apply to SATA or USB
disk devices, even though they use Linux SCSI
drivers.
UNIX Operating System
Why Partition Your Disk?
•
•
•
Multiple OS Support – keep different OSs
separate.
File system Choice – use different file system.
Different file system speeds might be a factor.
Disk Space Management –allows a user to
save certain sets of files into a fixed space. It
restricts users to storing in one or two
partitions, without causing problems in other
partitions.
UNIX Operating System
Why Partition Your Disk?
•
•
Disk Error Protection - file systems do
experience errors.
Security – a partition that contains critical
information can be mounted read-only. This
provides an additional layer of security above
the normal file and directory permissions.
UNIX Operating System
Why Partition Your Disk?
•
Backup – many Linux systems backup utilities
work better on whole disks. Keeping partitions
small is more advantageous for backing up,
than you could with large partitions.
UNIX Operating System
Partitioning a Disk
Traditionally, Linux used the fdisk utility
for disk partitioning. The full definition of the
utility name is fixed disk, which is the same
name used by DOS and Windows to basically
accomplish the same task.
UNIX Operating System
Understanding Partitioning Systems
Partitions are predefined by data structures
that are written to specific areas of the hard
disk. Today, there are several competing
systems to re-define partition use. On the x86
and x86-64 hardware, up to 2010 had been the
Master Boot Record (MBR) partitioning
system, where the data in the first sector of the
disk is known as the MBR. This configuration
is limited to partitions and partition placement
of 2 tebibytes (TiB; is 2 40th bytes), when
using sector size of 512 bytes.
UNIX Operating System
Understanding Partitioning Systems
The original x86 hardware partitioning
scheme allowed for four partitions. As hard
disks increased in size, it became apparent that
more partitions were needed, so the original
scheme was extended in such a way to retain
backward compatibility.
One of the main limitations with using the
original MBR method is the usage of 32 bits
for storing logical block addresses and size
information.
UNIX Operating System
MBR New Scheme
UNIX Operating System
Understanding Partitioning Systems
The new scheme utilizes three partition types;
• Primary partitions, which are the same as the
original partition types.
• Extended partitions, which are a special type
of primary partition that servers as a
placeholder for the logical partitions
• Logical partitions, which resides within an
extended partition
UNIX Operating System
Understanding Partitioning Systems
One successor to the MBR method is the GUID
(Globally Unique Identifiers) Partition Table (GPT)
partitioning system, which offers higher limits and
certain other advantages. GPT is the preferred
partitioning system for disks larger than 2TiB.
As of 2010, most operating systems support
GPT. GPT allocates 64 bits for logical block
addresses and allows a maximum size of 2 64th -1
sectors. GPT does not use the layout of primary,
extended, and logical distinction of MBR.
UNIX Operating System
UNIX Operating System
Role of the mount point
Once the disk partitions have been created, the
operating system must have some way to access the
data in the partition. In Windows systems this is done
by assigning a drive letter ( C: or D:). Linux does not
use a drive letter, but instead uses a unified directory
tree. Each partition is mounted at a mount point in
that tree. A mount point is a directory that is used as a
way to access the filesystem on the partition, and
mounting the filesystem is the process of linking the
filesystem to the mount point.
UNIX Operating System
Role of the mount point
Linux system has the following configuration:
Three partitions: (/), (/home), and (/usr)
partitions
The root partition holds the basic system
files, and all other partitions are accessed via
directories on that filesystem. If /home
contains user’s home directories, such as Bill
and Jane, those directories will be accessed as
/home/Bill and /home/Jane, once this partition
is mounted at /home.
UNIX Operating System
Are All Partitions Alike?
No
Some partitions do not hold files. Linux
uses a swap partition, as an extension of
memory. Linux can also use a swap file,
which is a file that works similar to the
swap partition. Both are examples of
swap space. Linux uses the /etc/fstab file
to define which partitions to use as swap
space and other filesystem.
UNIX Operating System
Points of interest
dos2unix is a function that converts
DOS/MAC plain text files into UNIX
format.
Coldplug devices are designed to be
physically connected and disconnected
only when the computer is turned off.
Moving Around in UNIX
top (Ctrl z)
jobs
mv
more
ssh -v
Login to remote host:
ssh -l jsmith remotehost.example.com
Check the status of a service:
service ssh status
Break-out problems
What is the function of the file manager?
What is an Apache Web Server?
What type of files are found in the lost+found
directory?
The super block is found in the first block of the
partition.
LDAP characteristics
PATA disks
SATA disks
SCSI disks
MBR and GPT
Mount point
Hands on information
Lab Assignment 13-1due April 7 and
14, 2015
Lab Assignment 14-1 due April 18,
2015
UNIX Operating System video:
https://www.youtube.com/watch?v=xHu7qI1gDPA
After class assistance
 Questions
 Comments
 Concerns
I
am available after this Franklin Live
session to discuss any problems and/or
concerns regarding the lab assignments
Lab Assistance available by phone
and/or email