linux project (final)
TRANSCRIPT
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 1/56
LINUX+
Open-Source Software
Rajat Goyal
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 2/56
2
Acknowledgement
I’d like to thank the pioneers of our industryfor blazing the trail and mapping the path to success,
vision, courage, perseverance and guide us to
perceive the future of Computingthrough an Operating System which we call it as
“LINUX”
Also,
I’d like to dedicate this to my Parents and Teachers for providing
a model of solid values andhard work for me to the path of Computing.
-- Rajat Goyal
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 3/56
3
Table of Contents
1. Linux : Overview……………………………………………………………………………………… .4 - 10
Introduction to Linux
Why we use Linux
Features of Linux
Linux v/s Windows
Linux Flavors
2. History of Linux……………………………………………………………………………………….11 - 18 Founders : Overview
Generation & Development
Linux Desktop
3. Open Source Software Development……………………………………………………..19 - 23
Open Source Software
Developer/Licensor Examples of Open Source Software
Preference Reasons for using Open Source Software
4. Linux Architecture…………………………………………………………………………………..24 - 56
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 4/56
4
Linux : Overview
Introduction to Linux
Linux is a generic term referring to “Unix-Like”
computer operating system based on Linux kernel. Linux isa freely distributed operating system that runs on multiplehardware platforms, which means that it is free and open-
source software in which all the underlying source code canbe used, freely modified, and redistributable by anyoneunder the terms of the GNU/GPL and other free licenses.
Linux is a complete multitasking and multiuser operating systembased on Linux kernel. The Linux kernel was originally developed for the Inte80386 with multitasking operations which is one of its best features. Thekernel is the code that controls the interface between user programme and
hardware devices. A Linux-based system is a modular Unix-like operating system. Iderives much of its basic design from principles established in UNIX duringthe 1970s and 1980s. Such a system uses a monolithic kernel, the Linuxkernel, which handles process control, networking, and peripheral and filesystem access. Device drivers are integrated directly with the kernel.
Separate projects that interface with the kernel provide much of thesystem's higher-level functionality. The GNU user land is an important part omost Linux-based systems, providing the most common implementation othe C library, a popular shell, and many of the common UNIX tools whichcarry out many basic operating system tasks. The graphical user interface (oGUI) used by most Linux systems is based on the X Window System.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 5/56
5
Why we Use Linux
This Unix-like open source software is widely used for the following
many reasons:
A Linux distribution has software worth thousands of dollars, fo
virtually no cost.
Linux operating system is reliable, stable, and very powerful.
Linux comes with a complete development environment, includingcompilers, toolkits, and scripting languages.
Linux comes with networking facilities, allowing you to share hardware
Linux utilizes your memory, CPU, and other hardware to the fullest.
A wide variety of commercial software is also available.
Linux is very easily upgradeable.
Supports multiple processors as standard.
True multitasking. So many apps, all at once.
The GUIs are more powerful than Mac!
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 6/56
6
Features of Linux
The Basic features of Linux which defines this software in a more
fruitful manner which are as follows:
Open source development model.
Supports wide variety of hardware.
Supports many networking protocols and configurations.
Supports more File systems.
Linux has a reputation for fewer bugs (programming mistakes) than
Windows.
True multitasking.
X Windows System - A graphical user interface similar to windows, busupports remote sessions over a network.
Advanced server functionality, FTP server Telnet server BOOTP server DHCP server Samba server
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 7/56
7
After installation you can create logins for different users.
Each user may login by his/her own login and password – own login area.
Upon login, default directory is home directory of the user.
Linux/Unix is case sensitive i.e. WHO is not same as who
UNIX shell is a command program to communicate with a computer.
Shell interprets the command that you enter on keyboards.
Shell commands can be used to automate various programming tasks.
Linux/UNIX has powerful text processing tools which are highly suited toworking with sequence data
Linux/Unix is very stable - computers running Linux/Unix almost never crash
Linux/Unix is very efficient It gets maximum number crunching power out of your processor (and
multiple processors) It can smoothly manage extremely huge amounts of data It can give a new life to otherwise obsolete Macs and PCs
It is easy for the programmers.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 8/56
8
‘Linux’ v/s ‘Windows’
Windows Linux
Windows is considered a Single-User, Multi-Tasking OS.
Linux is considered a Multi-User,Multi-Tasking OS.
It enables one user to perform multiple
tasks at once, but does not allowmultiple different users.
It allows multiple different users t
perform tasks simultaneously, anensures they do not interfere with eacother
Windows supports the FAT and NTFS filesystems.
Linux supports a wide variety of filsystems, including FAT, NTFS, ext/3/4ReiserFS, XFS, JFS, and many others.
Some ability to expand support via newdrivers.
Adding support for new ones is as easy aa kernel recompile.
MSRP for Windows Vista Home Basic is$199.95 MSRP for most Linux distributions i$free.MSRP for Windows Server 08 Std is $999for five access licenses. Additional accesslicenses are $199 for 5.
However, most of the time support is nofree and must be paid for.
Open Source Development Model and sothe programmer can redesign the OS.
It is not an open source and henccannot be redesigned by thprogrammer.
Linux is robust and very much secure fromvirus. Windows gets affected by virus vereasily.
The Linux server has surpassed windowsserver operating system in security.
Security is the main issue which has madwindows to think to survive.
There are 250000+ developers behind Linuxfor open source deployment.
Compared to Linux, a window ideveloped by few thousands of people.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 9/56
9
Linux Flavors
Red hat Linux (Red hat)
SuSE Linux (Novell)
Fedora Linux
Caldera Linux
Mandrake Linux
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 10/56
10
Turbo Linux
Slack ware Linux Project
Knoppix Linux LiveFile system
Ubuntu Linux
AsiaNux Linux
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 11/56
11
History of Linux
Founders: Overview
The UNIX operating system was conceived and implemented in the1960s and first released in 1970. Its wide availability and portability meanthat it was widely adopted, copied and modified by academic institutions and
businesses, with its design being influential on authors of other systems.The GNU Project, started in 1984 by Richard Stallman, had the goa
of creating a "complete Unix-compatible software system”, composedentirely of free software. The next year Stallman created the Free SoftwareFoundation and wrote the GNU General Public License (GNU GPL) in 1989
Linus Torvalds has said that if the GNU kernel had been available at the time(1991), he would not have decided to write his own.
In 1991 while attending the University of Helsinki, Torvalds began towork on a non-commercial replacement for MINIX, which would eventuallybecome the Linux kernel.
Linus Benedict Torvalds
The Linux operating system (OS) was first
coded by a Finnish computer programmer called LinusBenedict Torvalds in 1991, when he was just 21! Hehad got a new 386, and he found the existing DOS andUNIX too expensive and inadequate.
Linus Benedict Torvalds (born December 28, 1969) began thdevelopment of Linux, an operating system kernel, and today acts as the
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 12/56
12
project coordinator.Inspired by Minix (a kernel and operating system developed by
Andrew Tanenbaum), he felt the need for a capable UNIX operating systemthat he could run on his home PC. Torvalds did the original development othe Linux kernel primarily in his own time and on his equipment.
The Linux operating system (OS) was first coded by a Finnishcomputer programmer called Linus Benedict Torvalds in 1991, when he wajust 21! He had got a new 386, and he found the existing DOS and UNIX tooexpensive and inadequate.
In those days, a UNIX-like tiny, free OS called Minix was extensivelyused for academic purposes. Since its source code was available, Linusdecided to take Minix as a model.
Richard Matthew Stallman
Richard Matthew Stallman (born March
16, 1953), often abbreviated to "rms", is anAmerican software freedom activist, hacker, andsoftware developer. In September 1983, helaunched the GNU Project to create a free Unix-like operating system, and has been the project'slead architect and organizer. With the launch ofthe GNU Project, he started the free software movement and, in Octobe1985, set up the Free Software Foundation.
Stallman pioneered the concept of copyleft and is the main authoof several copyleft licenses including the GNU General Public License, thmost widely used free software license. Since the mid-1990s, Stallman haspent most of his time advocating for free software, as well as campaigning
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 13/56
13
against both software patents and what he sees as excessive extension ocopyright laws. Stallman has also developed a number of pieces of widely
used software, including the original Emacs, the GNU Compiler Collectionand the GNU Debugger. He co-founded the League for ProgrammingFreedom in 1989.
Andrew Stuart Tanenbaum
Andrew Stuart "Andy" Tanenbaum
(sometimes referred to by the handle AST)(born March 16, 1944) is a professor ofcomputer science at the Vrije Universiteit, Amsterdam in the Netherlands. He is bestknown as the author of MINIX, a free Unix-like operating system foteaching purposes, and for his computer science textbooks, regarded astandard texts in the field. He regards his teaching job as his most importan
work. Tanenbaum was born in New York City and grew up in suburbanWhite Plains, New York. He received his B.Sc. degree in Physics from MIT i1965. He received his Ph.D. degree in physics from the University oCalifornia, Berkeley in 1971. He moved to the Netherlands to live with hiwife, who is Dutch, but he retains his United States citizenship. He teachecourses about Computer Organization and Operating Systems and supervisethe work of Ph.D. candidates at the VU University Amsterdam.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 14/56
14
Generation&
DevelopmentA Linux-based system is a modular Unix-like operating system. I
derives much of its basic design from principles established in UNIX duringthe 1970s and 1980s. Such a system uses a monolithic kernel, the Linuxkernel, which handles process control, networking, and peripheral and filesystem access. Device drivers are integrated directly with the kernel.
Separate projects that interface with the kernel provide much of thesystem's higher-level functionality. The GNU user land is an important part omost Linux-based systems, providing the most common implementation othe C library, a popular shell, and many of the common Unix tools whichcarry out many basic operating system tasks. The graphical user interface (oGUI) used by most Linux systems is based on the X Window System.
UNIX
Unix (officially trademarked as UNIX, sometimes also written aUNIX with small caps) is a computer operating system originally developed in1969 by a group of AT&T employees at Bell Labs, including Ken ThompsonDennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna. Today'UNIX systems are split into various branches, developed over time by AT&Tas well as various commercial vendors and non-profit organizations.
As of 2007, the owner of the trademark is The Open Group, anindustry standards consortium. Only systems fully compliant with andcertified according to the Single UNIX Specification are qualified to use thetrademark; others are called "Unix system-like" or "Unix-like".
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 15/56
15
UNIX operating systems are widely used in both servers andworkstations. UNIX was designed to be portable, multi-tasking and mult
user in a time-sharing configuration. In 1983, Richard Stallman announcedthe GNU project, an ambitious effort to create a free software Unix-likesystem; "free" in that everyone who received a copy would be free to usestudy, modify, and redistribute it. The GNU project's own kernedevelopment project, GNU Hurd, had not produced a working kernel, but in1992 Linus Torvalds released the Linux kernel as free software under theGNU General Public License. In addition to their use in the Linux operating
system, many GNU packages — such as the GNU Compiler Collection (andthe rest of the GNU toolchain), the GNU C library and the GNU core utilitie— have gone on to play central roles in other free Unix systems as well.
MINIX
MINIX is a Unix-like computer operating system based on
microkernel architecture. Andrew S. Tanenbaum wrote the operatingsystem to be used for educational purposes; MINIX also inspired the creationof the Linux kernel. Its name is a portmanteau of the words minimal andUNIX. Minix has been free and open source software since it was releasedunder the BSD license in April 2000.
Andrew S. Tanenbaum created MINIX at Vrije Universiteit inAmsterdam to exemplify the principles conveyed in his textbook, Operating
Systems Design and Implementation (1987). An abridged 12,000 lines of the Csource code of the kernel, memory manager, and file system of MINIX 1.
are printed in the book. Prentice-Hall also released MINIX source code andbinaries on floppy disk with a reference manual. MINIX 1 was system-cacompatible with Seventh Edition Unix.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 16/56
16
LINUX
A Linux-based system is a modular Unix-like operating system. Iderives much of its basic design from principles established in UNIX duringthe 1970s and 1980s. Such a system uses a monolithic kernel, the Linuxkernel, which handles process control, networking, and peripheral and filesystem access. Device drivers are integrated directly with the kernel.
Separate projects that interface with the kernel provide much of thesystem's higher-level functionality. The GNU userland is an important part omost Linux-based systems, providing the most common implementation othe C library, a popular shell, and many of the common Unix tools whichcarry out many basic operating system tasks. The graphical user interface (oGUI) used by most Linux systems is based on the X Window System.
Linux distributions, comprising Linux and large collections ocompatible software have become popular both with individual users and inbusiness. Popular distributions include Red Hat Enterprise Linux, Fedora
SUSE Linux Enterprise, openSUSE, Debian GNU/Linux, Ubuntu, MandrivLinux, Slackware Linux and Gentoo.
Linux Desktops
Desktops
GNOME KDE
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 17/56
17
GNOME
GNOME is a desktop environment—agraphical user interface which runs on top of acomputer operating system—composed entirely offree software. It is an international project thatincludes creating software development frameworks,selecting application software for the desktop, and working on theprograms which manage application launching, file handling, and window
and task management.GNOME is part of the GNU Project and can be used with variou
Unix-like operating systems, most notably those built on top of the Linuxkernel and the GNU userland, and as part of Java Desktop System in Solaris.
KDE
KDE is a free software project based around itsflagship product, a desktop environment mainly forUnix-like systems. The goal of the project is to providebasic desktop functions and applications for daily needs as well as tools anddocumentation for developers to write stand-alone applications for thesystem. In this regard, the KDE project serves as an umbrella project fomany standalone applications and smaller projects that are based on KDE
technology. These include KOffice, KDevelop, Amarok, K3b and many othersKDE software is based on the Qt toolkit. The original GPL version of thitoolkit only existed for the X11 platform, but with the release of Qt 4, GPversions are available for all platforms. This allows KDE software based on Q4 to also be distributed to Microsoft Windows and Mac OS X.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 18/56
18
Desktops
GNOME KDE
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 19/56
19
Open Source SoftwareDevelopment
Developed on the Web No Single Vendor
Low Cost Multi-Platform
Community Small & ModularDeveloped & Owned
Standards Based
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 20/56
20
Open Source Software
In 1979, AT&T introduces their Unix License, which is actually even bytoday is pretty much expensive. For educational institutions, you can get oneCPU license for 7500 Dollars (Rs. 3,75,000) per CPU and if you want a fulcommercial license, it will cost you around 60,000 Dollars (Rs. 30,00,000) peCPU.
Richard Matthew Stallman, an American Software freedom activist, ahacker and software developer, started the Free Software Foundation and
the GNU Project. He pioneered and created GPL (General Public License) fothe GNU Project, which is a widely used free software license and is the mospopular and well-known example of Copyleft license. Stallman’s goal was toproduce one license that could be used for any project, thus making ipossible for many projects to share code. This Software Foundation isdesigned to promote Free and Open source software or software which iliberally licensed to grant the right of users to study, change, and improve its
design through the availability of its source code. Open Source is a term, developed in 1997, to represent free software
that is distributed with the source files. End users can modify and recompilethe software to meet their needs. For instance:-
for x:= 0 to 100 do
{
if x == 50 print “halfway done” else
print x}
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 21/56
21
Closed Source means any software that is distributed without thesource files. End users cannot modify and recompile the software according
to their needs. For instance:-000111010101111100001000111110000111001111100000001111110101010101011001100101010101010111110011101010111111110000011111100001111000011111110010101010100101110011001010111010000001011010010101010101011010100011111001000000000011110000111000010010101011101010101100111100001110001111100011111000001111100001111111000111100011010101010100011111001010101010111100001010101
010010001001110101010001001011010101010101010101010101010101
Copyleft: - Copyleft is a play on the word copyright to describe the practiceof using copyright law to remove restrictions on distributing copies. It is aform of licensing and can be used to modify copyrights for works such acomputer software, documents, music and art.
GNU General Public License: - The GPL grants the recipients of acomputer program the rights of the free software definition and usecopyleft to ensure the freedoms are preserved, even when the work ichanged or added to.
Open Source software is software licensed under an agreement thaconforms to the Open Source definition: Access to Source code. Freedom to Redistribute. Freedom to Modify. Non-Discriminatory Licensing (licensee/product). Integrity of Authorship. Redistribution in accordance with the Open Source License Agreement.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 22/56
22
Developer/Licensor
Any Developer/Licensor can draft an agreement that conforms to theOpen Source Development, though most licensors use existing agreements
GNU Public License (“GPL”)
Lesser/Library GNU Public License (“LGPL”)
Mozilla Public License.
Berkeley Software Distribution License (“BSD”)
Apache Software License.
Two widely used open source licenses have “Copyleft” provisions. GNU Public License (“GPL”) Lesser GNU Public License or Library GNU Public License (“LGPL”)
Most Other licenses do not have Copyleft terms.
Project-Based Development by Informal Networks Maintainers
Corporations (IBM, HP, Sun) Non-Profit Foundations (Apache Software Foundation) Individuals (Linus Torvalds)
Contributors
Users
Distribution, Updates and Upgrades.
Third Party Vendors
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 23/56
23
Examples of Open Source Software
Linux (Operating system kernel-substitutes for proprietary UNIX) Apache Web Server (Web Server for UNIX systems) MySQL (Structured Query Language – competes with Oracle) Cloudspace, Eclipse (IBM contributions) OpenOffice (Open source implementation of Sun’s StarOffice)
Preference Reasons for using Open Source Software
Cost Savings.
Stability.
No forced upgrades.
Access and broad rights to source code.
Ability to define and expedite new development.
Access to skilled community of developers.
Migration cost.
Copyleft provisions of GPL, LGPL and similar licenses.
Uncertainty about open development model.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 24/56
24
Linux Architecture
Particulars
I. Component Facts. 25
II. Directory Contents. 27
III. Computer Roles. 28
IV. Installation Facts. 29
V. Users & Groups. 31
VI. Managing the File System. 35
VII. Services. 43
VIII. Boot & Shutdown. 45
IX. Networking. 47
X. Security. 52
XI. Troubleshooting. 53
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 25/56
25
I. Component Facts
The Linux operating system is a modular system, which means that thecomponents can function without affecting one another. Because of its modulanature, you can create a highly customized Linux operating system based on youindividual requirements. The table below lists the modules typical to Linux. Eachcomponent (or set of components) is generally developed independently, andeach component offers functionality while minimally affecting the othecomponents.
Component Description Examples
Kernel The kernel is the core component of the
operating system.
The kernel coordinates communicationbetween the hardware and other softwarecomponents.
The kernel is the only component that istechnically Linux. All other components are add-ons that turn the system into a fully-functional
operating system.
The kernel is constantly being updatedCurrent and previous kernel versions canbe found at www.kernel.org.
Shell The shell is the user interface that accepts and
interprets commands (either from a commandprompt or a script) and forwards them to thekernel.
A Linux shell is comparable to the DOSinterpreter/DOS prompt.
bash (Bourne-Again Shell) is the mostcommon (and default) Linux shell. It is anenhancement of the original Bourne shel(sh).
tcsh is an enhanced version of theBerkeley UNIX C-shell (csh).
Graphical UserInterface (GUI)
The GUI is responsible for drawing graphicalelements on the computer screen.
The Linux GUI was designed to work the same
way regardless of the video hardware on thecomputer system
XWindows is the most common GUsystem. X Windows works in conjunctionwith an X Client to render the GUI. X
Windows is capable of running as aserver and sending the GUI images toseparate machines running an X ClientXfree86 is the most common X Client
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 26/56
26
WindowManager/DesktopEnvironment
A Windows emulator is an implementation ofthe Microsoft Windows API.
The emulator lets you run Windows applicationson Linux without running the Windowsoperating system.
KDE (Kommon Desktop Environment)which uses the K Window Manager(kwm) and comes with the Qt toolkitfor C++. GNOME (GNU Object ModeEnvironment) does not specify awindow manager because its designallows use of any window managerHowever, it does use Metacity as adefault window manager in the absenceof a window manager. GNOME requiresthe use of the GIMP Toolkit (GTK) torender the full GNOME desktop.
Boot Loader A boot loader runs after the system executesthe BIOS ROM and POST functions.
It loads the Linux kernel from the boot partitionon the hard disk.
It is also used to boot other operating systemspresent on the computer.
LILO (LInux LOader) is the mostcommon bootloader.
GRUB (GRand Unified Bootloader) is anew bootloader that offers extrafunctionality.
Daemons(Services)
Daemons are programs that run in thebackground, providing additional functionality
to a system. The Windows equivalent of a daemon is aservice.
File/Print Services SMB/SambaNFS
Print services LPRCUPS
Web Server ApacheTomcat
Domain Name Service(DNS)
BIND
E-mail SendmailPostfix
Firewall ipchainsSmoothwallAstaro SecurityLinux
Proxy Server Squid
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 27/56
27
II. Directory Contents
The unified file system uses a single root directory that contains various othedirectories. File systems from other hard drive partitions mount to directories beneatthe root directory, providing access to a single directory structure.
Directory Description
/ The / character represents the root directory of the Linux system. All directories are below the / (rootdirectory) of the system.
/bin The /bin directory contains binary commands that are available to all users.
/boot The /boot directory contains the kernel and boot loader files.
/dev The /dev directory contains device files.
/etc The /etc directory contains configuration files specific to the system.
/home The /home directory contains by default the user home directories.
/initrd The /initrd directory is used during the boot process to hold the initial RAM drive image.
/lib The /lib directory contains shared program libraries and kernel modules.
/media The /media directory contains the /cdrom and /floppy directories. It is the point where CD-ROM andfloppy drives can be mounted according to the FHS (Filesystem Hierarchy Standard) v2.3.
/mnt The /mnt directory is an empty directory. This was the mount point for CD-ROM and floppy drives prior toFHS v2.3.
/opt The /opt directory contains the additional programs.
/proc The /proc directory contains information about the system state and processes.
/root The /root directory is the root user's home directory. Do not confuse /root with the root of the system (/)/sbin The /sbin directory contains system binary commands.
/srv The /srv directory contains files for services like the FTP and Web servers.
/sys The /sys directory is new with release 2.6. It takes some of the system state date that was previouslycontained in /proc.
/tmp The /tmp directory contains temporary files created by programs during system use.
/usr The /usr directory contains system commands and utilities. /usr holds the following directories: /usr/bin /usr/lib /usr/local /usr/sbin
/usr/X11R6 (for the X Window system)Depending on the implementation, the /usr directory might also include the /usr/doc subdirectory (or/usr/share/doc subdirectory) to hold documentation accessible to all users.
/var The /var directory contains data files that change constantly. Standard subdirectories include: /var/mail (holds e-mail in boxes) /var/spool (holds files waiting for processing, such as print jobs or scheduled jobs) /var/www (holds www or proxy cache files)
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 28/56
28
III. Computer Roles
Before you install Linux, you should know how you'll use the system. Theway the system is used will determine what kinds of components you shouldselect to install. The table below lists common deployments for Linux systems andthe components those deployments should include.
Role Description Common Components
Desktop A desktop implementation is targeted to theend-user in environments such as home-based
computers (for gaming, multi-media, or Websurfing) or home offices.
Graphical desktop Web browser (like Mozilla) E-mail client Productivity tools (an office productivity
suite like GNOME Office, for example) Sound, graphics, and video support Gaming support
Workstation A workstation implementation is for largecorporate installation, system administrators,or developers. Office workstations often havemore business productivity applications whileworkstations for software developers and
system administrators have tools for creatingand compiling software and administeringnetwork resources.
Word processor Database editor Desktop publishing applications Spreadsheet applications E-mail applications
Development tools System administration tools
Server A server provides networking services tomultiple users or to other computers. Becauseend users do not typically log on to a serverdirectly, graphical and multimediacomponents are often not installed on serversto conserve system resources and eliminatesources of problems. Linux can provide manydifferent services (e.g., file, email, and Webservices) on one machine unless it is beingaccessed by a very large number of people.
Mail services Routing Proxy service FTP service Web services (to allow users to access
information, like an online catalog forexample, through a Web browser)
Network file system (NFS) (for filesharing)
Storage (e.g., an appliance server) Database services (for storing client
information, for example)
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 30/56
30
Installation Method
Description
GUI install With the GUI method, you make installation choices using the mouse and keyboard from graphicainstallation screen.The GUI install is the default install for most distributions.
Text install A text install bypasses the GUI screens, giving you basic text screens instead.Use the text install if the system has video card problems or low video support.
Scripted In a scripted installation, you answer all installation questions ahead of time. Your responses arestored in a file that is then read by the install program. The installation progresses withoutinteraction.Use this system for a fully automated install and to quickly install on multiple systems.
Although the installation process differs depending on the distribution, thfollowing list represents a fairly generic installation process you will follow:
1. Identify network requirements, select a distribution, identify the computer role, and verify that ahardware meets system requirements
2. Select an installation file location and installation method3. Start the installation4. Choose the installation language and the system keyboard and mouse5. Partition the hard disk6. Configure the boot loader
7. Configure the network and firewall8. Choose a system language and time zone9. Create user accounts and configure authentication10. Select components and services to install11. Configure the video hardware12. Install components and create boot disks13. Select monitor and X Windows settings
During installation, the super user account, called the root user, is createdFollowing installation, you can log on to Linux by typing root as the username and the
supplying the password you entered during installation.Red Hat Linux provides you with the redhat-config-language command that runs witan active X server occurrence to change the default language on your system afteinstallation.
Linux systems can determine the date and time in three ways:
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 31/56
31
Set the system clock to GMT (Greenwich-Meridian time) and then use thecorrect time zone to interpolate the local time.
Set the system clock to the local time. NTP (network time protocol) to automatically synchronize the system date
and time with time servers on the network/Internet.
V. Users & Groups
User accounts control the ability to log on to a system, access resources, andperform certain actions. Groups provide a means of grouping users fo
administrative purposes such as assigning permissions to files.
When you work with users and groups, you will use a friendly name (such asmary or sales) to refer to the user or group. However, the system uses IDnumbers to identify users and groups.
The user ID (UID) and the group ID (GID) are typically automatically assigned by thesystem (although in some cases you can modify the ID number if you like).
The root user has a UID of 0.
Users you create are assigned UIDs 500 and above.
Users can be members of two different group types:
Primary group (also called the private group). By default, when you create a user, acorresponding group is also created. The user is the only member of this group. Whenyou create files and directories, the primary group is automatically made the owner othose files.
Secondary groups. Secondary groups are groups you create. You assign members tothose groups, and then use permissions to control access to files.
Note: The primary group is just a group like any other group. The only difference ithat the user account specifically identifies the primary group for each user.The user and group databases are stored in the following files:
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 32/56
32
File Description
/etc/passwd Holds user account information including the user name, UID, primary group membership, and thehome directory location.
/etc/shadow Holds passwords and password expiration information for user accounts. Using a separate fileincreases the security of the user passwords.
/etc/group Holds group information including the group name, GID, and group membership information.
/etc/gshadow Holds passwords for groups.
Users Command & Files
User account information is stored in two different files. The table belowdescribes these files and their sample content.
File Contents
/etc/passwd Each line identifies a user account.
Each line contains multiple fields, with each field separated by a colon.
Shown below is a sample line from the passwd file:
pclark:x:501:501:Petunia Clark:/home/pclark:/bin/bash
The fields within this line are as follows:
1. User account name.
2. Password. An x in the field indicates passwords are stored in the /etc/shadow file.
3. User ID number.
4. Primary group ID number, typically this number matches the UID number.
5. GECOS field, typically used for a description or the user's full name.
6. Path to the home directory.
7. Path to the default shell.
/etc/shadow Like the /etc/passwd file, each line corresponds to a user account.Each line consists of fields separated by colons.Shown below is a sample entry:
pclark:$ab7Y56gu9bs:12567:0:99999:7:::
1. User account name.2. Password. The $ in front of the password identifies the password as an encrypted entry.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 33/56
33
3. Last change. The date of the most recent password change, measured in the number of dayssince 1 January 1970.
4. Minimum password age. The minimum number of days the user must wait before changing
the password.5. Maximum password age. The maximum number of days between password changes.6. Password change warning. The number of days a user is warned before the password must be
changed.7. Grace logins. The number of days the user can log in without changing the password.
8. Disable time. The number of days since 1 January 1970, after which the account will bedisabled.
Although it is possible to edit the passwd and shadow files manually to manage user accounts, doinso can disable your system. Instead, use a GUI utility or the following commands to manage user accounts.
Use... To... Example
useradd name Create a user account. By default, whenyou create a user account, you create ahome directory for that user with the samename under /home/username.
useradd pmaxwell creates the pmaxweluser account
useradd -c text name Add a description for the account in theGECOS field of /etc/passwd.
useradd -c "Paul Morrill" pmorril createsthe pmorril account with a comment
useradd -d path name Assign an absolute pathname to a customhome directory location.
useradd -d /tmpusr/sales1 sales1 createsthe sales1 user account with homedirectory located at /tmpusr/sales1
useradd -u ID name Assign the user a custom UID. This is usefulif you want to assign ownership of files anddirectories to a different user.
useradd -u 789 dphilips creates thedphilips account with user ID 789
usermod name Modify an existing user account. usermod uses the same switches as useradd.
usermod -c "Paul Morril" pmorril changesthe comment field for user pmorril
usermod -l newnamename
Rename a user account. When renamingthe account, use the -d switch to renamethe home directory, and use the -m switchto copy all files from the existing homedirectory to the new home directory.
usermod -l esmith -d /home/esmith -mejones renames the ejones account toesmith, renames the home directory, andmoves the old home directory contents tothe new location
usermod -s path name Modifies the default shell setting for the
user account.
usermod -s /bin/tsch esmith points the
shell for esmith to /bin/tsch
userdel name Remove the user from the system. userdel pmaxwell deletes the pmaxwelaccount while leaving the home directoryon the system
userdel -r name Remove the user and the user's homedirectory.
userdel -r pmorril removes both theaccount and the home directory
Note: If you ever edit the user database files manually, use the vipw command. This command locks the user files and opens themin vi for editing.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 34/56
34
Group Commands & Files
Group information is stored in two different files. The table below describes these fileand their sample content.
File Contents
/etc/group Each line identifies a group.
Each line contains multiple fields, with each field separated by a colon.
Shown below is a sample line from the passwd file:
sales:x:510:pclark,mmckay,hsamson
The fields within this line are as follows:1. Group name.
2. Group password, this field will have an x if group passwords are contained in the gshadowfile.
3. Group ID.
4. Group members, a comma-separated list of user accounts that are members of the group.
/etc/gshadow Like the /etc/group file, each line corresponds to a group.
Each line consists of fields separated by colons.
Shown below is a sample entry:
sales:!:pclark:pclark,mmckay,hsamson
The fields within this line are as follows:
1. Group name
2. Group password. The group password allows users to add themselves as members of theaccount. If the field contains a single exclamation point (!), the group account cannot beaccessed using the password. If the field contains a double exclamation point (!!), nopassword has been assigned to the group account (and it cannot be accessed using thepassword). If there is no value, only group members can log in to the group account.
3. Administrators. This field contains a list of users (in comma-delimited format) who haveauthorization to administer the account.
4. Group members, a comma-separated list of user accounts that are members of the group.
Use the commands in the table below to manage Linux groups.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 35/56
35
Use... To... Example
groupadd name Create a group. groupadd sales creates the sales groupgroupmod -nnewname name
Change the name of a group. groupmod -n sales2 sales renames the sales group to sales2
groupdel name Delete a group. groupdel mktg deletes the mktg group
gpasswd name Change a group password (usethe -r option to remove a grouppassword).
Typing gpasswd sales prompts you to type the grouppassword
newgrp name Log in to a new group. You musthave the group password tocomplete this command.
Typing newgrp sales prompts you for the password for thesales group so you can log in
usermod -g group user
Assign a user to a primarygroup.
useradd -g pmaxwell pmaxwell assigns primary groupmembership for user pmaxwell to the pmaxwell group
usermod -G group1,group2user
Assign a user to a secondarygroup (or groups). Follow thecommand with a comma-separated list of groups.
usermod -G sales,mktg pmorril removes all existing groupassignments for pmorril and makes the user account amember of the sales and mktg groups. (You can remove a userfrom all secondary groups by using the command usermod -G"" user .)
Note: When you assign a user to one or more secondary groups, all existing secondary group membership is removebefore assigning the user account to the listed groups.
VI. Managing the File system
Permission Facts
Every file has an inode (information node) that stores information about the fileincluding when the file was last modified, file size, data block location, permissions, andownership (remember, directories are also files in the Linux system). The portion of the inode
that stores permission information is called the mode. The mode has three sections: User (owner) permissions Group (group owner) permissions Other (everyone on the Linux system) permissions
There are three types of permissions contained in the mode, each of which idescribed in the table below.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 36/56
36
Permission LetterAbbreviation
Octal Value Allowed Actions on Files Allowed Actions on Directories
Read r 100 (binary)4 (decimal)
Open and read the file List directory contents if theexecute permission is also present
Write w 10 (binary)
2 (decimal)
Open, read, and edit the file Add, delete, and rename files ithe execute permission is alsopresent
Execute x 1 (binary &decimal)
Execute the file (if it's aprogram file) or the shell script
Enter the directory and work withits contents
When you identify permissions, you can either use the letter abbreviation (r, w, x), othe octal number that corresponds to the permission. The following graphic shows a detailed
depiction of how permissions are displayed and how they can be referenced.
You should note the following facts about the mode:
A d preceding the permissions indicates that the object is a directory. A - identifies a fil(the example above is for a file).
Permissions are grouped according to user, group, or other permissions. If a permission has not been assigned, a - takes its place in order. When using numbers to represent permissions, add the decimal numbers togethe
within each permission group. Then string the numbers together. For example, thpermissions in the graphic above can be represented by the number 764.
The root user has all permissions to files and directories regardless of what the modeindicates.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 37/56
37
Default Permissions and Umask
By default, files receive rw-rw-rw- (666) permissions, and directories receivrwxrwxrwx (777) permissions when they are created. In most cases, the default assignmengives excessive permission to files and directories.
You can customize the default permission assignments by setting a umask. The umasidentifies which permissions are removed from the default permissions when files andirectories are created. The following table shows what happens when you set a umask valuof 022.
Files Directories
DefaultPermission
666rw-rw-rw-
777rwxrwxrwx
Umask 022
Result 644rw-r--r--
755rwxr-xr-x
In the example above, when you create a file, the umask value (022) is subtracted fromthe default permissions for new files (666). This gives you permissions of 666 - 022 = 644 orw-r--r--.
Note: When subtracting permissions using the umask, use binary math (not decimal math) toidentify the exact permissions removed. Be sure to remove permissions from the systemdefaults, not from all permissions (777 for both files and directories).
Additional examples of umask calculations are:
A umask of 066 results in file permissions of rw-------- (600) and directory permissions orwx--x--x (711).
A umask of 033 results in file permissions of rw-r--r-- (644) and directory permissions orwxr--r-- (744). Notice that the file permissions are not 633 as you would get if yoperformed decimal math using the umask setting.
A umask of 011 results in no changes to file permissions (the x permission is alreadremoved by default) and directory permissions of rwxrw-rw- (766).
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 38/56
38
Ownership Facts
When a user creates a file (or directory), the user and the user's primary groupreceive ownership for the file (or directory). File ownership determines which users arallowed to change the file's ownership and permissions. Only a file owner and the root usecan change file ownership or permissions.
The three permission settings in the table below comprise a "fourth group" that alsoaffects file ownership. You need to understand how to work with these settings iconjunction with permissions.
Setting Letter Abbreviation OctalAbbreviation
Description
SUID(SetUser ID)
s in the execute permissionposition of the userpermissionsExample: rwsrw-rw-
100 (binary)4 (decimal)
If the SUID bit is set, the program will run with thepermissions of the file owner, not with the permissions ofthe user who runs the program.
The most common use of SUID is to allow users to run acommand as the root user. Users do not become the rootuser, but rather the command or program runs as ifexecuted by the root user.
Some programs require the SUID bit set for proper
functionality.Be careful in setting the SUID bit as it could give a programtoo many permissions.
SGID(SetGroupID)
s in the execute permissionposition of the grouppermissionsExample: rwxrwsrw-
10 (binary)2 (decimal)
If the SGID bit is set, the program will run with the grouppermissions of the group owner.
This can also present security risks to your system.
StickyBit
t in the execute permissionposition of the otherpermissionsExample: rwxrw-rwt
1 (binary anddecimal)
This marks the file in such a way as to prevent the file'sdeletion from the system by anyone except the file ownerSetting the sticky bit works particularly well with sharedfiles.
Each fourth group setting precedes the standard octal representation of a set of permissions. For example: 4421 sets the SUID 2421 sets the SGID 1421 sets the sticky bit 6421 sets both the SUID and SGID 7421 sets all three
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 39/56
39
Permission Commands
The table below lists the most common commands for managing file permissions.
Use... To... Example
chmodcategory+permission filename
Add a permission for a user, group, orother (category) to a file.
chmod u+x,g+x,o+x myfile
This syntax adds the execute permission to the filemyfile for user, group, and other.
chmod category
permission filename
Remove a permission for a user,group, or other from a file.
chmod g-w,o-w myfile
This syntax removes the write permission for group
and other from the filemyfile.chmodcategory=permission filename
Makes the permission equal to thepermission specified for the user,group, or other for the file.
chmod u=rwx myfile
This syntax grants the user read, write, and executepermission for the filemyfile.
chmod number
filename
Sets the permissions for the fileaccording to the numbersrepresented for each mode category.
chmod 711 myfile
This syntax grants the user read, write, and executepermission (7) while group and other both receiveexecute permission (1) for the filemyfile.
umask View the current umask setting 022 is the typical umask setting.
umask number Change the default umask (normally022).
umask 007
This syntax sets the umask to remove nothing fromthe user or group but to remove all permissions fromother.
Ownership Commands
The table below lists the most common commands for managing file ownership.
Use... To... Example
ls -l View a long file listing. A long file listing shows the ownership,permissions, and names for the files (among otherinformation).
drwxr-xr-x 22 root root 4096 Jun 19 15:01sales
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 40/56
40
chown user filename Change the ownership of a file (ordirectory). Only the root user or owner of
the file can execute this command.
chown pmorril /sales/report makes pmorril theuser owner of the /sales/report file
chown -R user
filename
Change the ownership of the file recursivelythroughout the directory tree.
chown -R pmorril /sales makes pmorril theowner of all files in the /sales directory (andbelow)
chown user : group
filename
Change the user and group ownership ofthe file.
chown pmaxwell:sales /sales/report makespmaxwell the user owner and sales the groupowner of the file
chown : group
filename chgrp group
filename
Change the group owner of a file. chown :sales -R /sales makes the sales groupthe owner of all files in the /sales directorychgrp sales /sales/report makes the salesgroup the group owner of the file
File Management Commands
The table below lists the most common file management commands.
Use... To... Example
cat filename
filename
Append the second file tothe end of the first and
display the output onscreen.
cat cam_proj new_specs combines the new_specs file with thecam_proj file.
cdrecordoptions dev=#,#,# speed=# filename
Write a file to a CD-RWdevice.
cdrecord -v dev=0,0,0 speed=2 -
data/home/jwalton/multimedia_project writes themultimedia_project file to the CD-RW device as a data file. The -dataoption creates a data cd, and the -audio option creates an audio cdThe -v (verbose) option allows you to see recording progress.
cp source
destination
Copy a file to a newlocation. When you copy afile, you create a new file.File ownership and
permission comes from theuser who ran the cpcommand.
cp proj /ongoing/projects cp proj /ongoing/projects/proj
Either command copies the proj file to the /ongoing/projectsdirectory.
Diff filename
filename
Find the differencesbetween two files.
diff cam_proj cam_proj1 finds the differences between the twonamed files.
file filename(s)
View the file type(s) for thedesignated file(s).
file /bin/* | less shows the file type for each of the files in the /bindirectory. (This command pipes the output to less to allow you toview each file line-by-line or page-by-page.)
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 41/56
41
ln filename
filename
Create a hard link between files. Ahard link creates an exact copy of afile. You can create an unlimitednumber of hard links to a file, butthey all have to be on the same filesystem. Using the -s option allowsyou to create a symbolic link to a file.A symbolic link is a shortcut to theoriginal file.
ln /home/jsmith/projects/home/edunford/projects
creates an exact copy of /home/jsmith/projects in/home/edunford/projects.
mkdir directory
name
Create a directory. mkdir projects creates a projects directory in the currentworking directory.
mkdir -p path Create a directory tree structure. mkdir -p completed/projects creates the
completed/projects subdirectory in the current workingdirectory.
mv source
destination
Move a file to a new location. This isalso the command used to rename anexisting file using a new name. Whenyou move a file, permissions stay thesame (although you need thepermissions to move the file).
mv ongoing/projects/proj completed/projects/proj
moves the proj file from /ongoing/projects to/completed/projects.
rm filename Delete a file. rm proj removes the proj file the system.
rm -f filename Delete a file without a warningprompt.
rm -f proj immediately removes the proj file from thesystem without prompting.
rmdir directory Delete a directory (the directorymust be empty).
rmdir /projects -- Removes the projects directory fromthe system.
rm -r directory Delete a directory and its contents(use the -rf switches together todelete without prompting). Take carewith this command because rm -rf*deletes all files in the system.
rm -rf completed/ removes the directory structurebeginning with the /completed directoryrm -rf * removes all files without prompting (do not usethis command).
touch filename Change a file's timestamp. touch proj changes the access and modification times ofthe proj file to the current time.
du path
Commonswitchesinclude:
-c list a totalnumber forthe size
-h display theoutput in
List files and file sizes in and belowthe specified directory.
du -c /home/badams lists all files and directories inbadams' home directory along with a file size and a totalamount of space taken up by the directorydu -c -s /home/badams shows the total amount of spacetaken up in badams' home directory.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 42/56
42
Humanreadable
format(bytes, KB,MB, GB)
-s list onlythe total,not each file
df path List the free space in the partitionholding the specified directory. (Usethe -h option to get human readableoutput.)
df /home lists the free space on the partition that holdsthe /home directory.
You should also know the following facts about working with files:
Hidden files (files not shown by the ls command) are files that start with a period. To show hidden files with the ls command, use the -a option. Commonly used commands often use aliases (an alias is a shortcut to a command). Two
common aliases areo ll = ls -lo la = ls -a
You can set up command aliases of your own in .bash_profile file in your home directory. Thiis one of several files that set the system configuration. .bash_profile executes after thsystemwide profile file, /etc/profile.
To execute programs:o Enter the executable name to run a program directly. (This only works for files that are
on your path.)o Enter ./filename to run an executable when you are in a directory that is not on you
path.o Enter the full pathname to the file to run an executable from anywhere.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 43/56
43
VII. Services.
Managing most services is done by executing a shell script that corresponds tthe service. Shell scripts are typically located in /etc/rc.d/init.d, although a symbolic linpointing to this directory might also exist at /etc/init.d. Shell scripts contain a series oactions to start, stop, and otherwise manage the service. The table below lists the moscommon commands for managing services.
Use... To... Example
/etc/rc.d/init.d/servicename option
Run the shell script associatedwith the service. The optionsavailable depend on the shellscript. Most scripts includethe following options:
start
stop
status
restart
reload
* (shows a list ofavailable options)
/etc/rc.d/init.d atd start
/etc/rc.d/init.d atd restart
service --status-all View the status of all services Use this command as shown to get a list of service
status.service servicename option Use the service command line
tool to manage services(eliminates the need to typethe service's full path).
service atd start
service atd restart
Package Manager Facts
A package manager is a software application that installs and maintains software. The packagmanager maintains a database of software information that you can query to view installed softwareHowever, package managers don't allow users to compile the software as part of the installation process.
Two common package managers include: RPM--The Red Hat Package Manager is the most widely supported package manager. DPKG--Similar to rpm, the Debian Package Manager is designed to manage software for Debian Linux
It offers functionality equal to rpm, but it is not as widely supported or distributed.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 44/56
44
Package Manager Commands
The table below lists the most common rpm commands.
Use... To... Example
rpm option(s) filename.version.architecture.rpmCommon installation options:
-i install -v verbose -h hashmarks (to show progress)
Install a software package. rpm -ih mozilla-1.7-0.2.0.i386.rpm installs theMozilla Web browser andmail reader.
rpm -U filename.version.architecture.rpm Upgrade an existing software package. Ifthe software does not exist on thesystem, -U acts as the -i option.
rpm -Uh mozilla-1.7.2-0.2.0.i386.rpm upgrades
the Mozilla Web browser
and mail reader with thenewer file.
rpm -e filename Erase (uninstall) a software package. rpm -e mojo-2.8.3-1.i386.rpm uninstalls aWeb-based mailing listmanager.
rpm -F filename Upgrade a package that is alreadyinstalled on the system. If the packagedoesn't exist on the system, rpm -F willnot install it.
rpm -F mojo-2.9.1-1.i386.rpm locates thepackage and upgrades it ifan older version iscurrently on the system.
rpm -q filename Options that commonly follow -q:
-i info (detailed listing) -l list package files -a all (show all installed packages)
Query the rpm database to findinformation about installed softwarepackages.
rpm -qi crafty-16.6 returnsinformation on the craftychess game.
rpm -qa | grep string Query the database for text that matchesstring . This is useful if you know part ofthe file name of a software application.The | (pipe) parameter redirects theresults of the -qa options to the grep shellcommand which filters out all information
that does not match string .
rpm -qa | grepvoicecontrol returnsinformation on a voicerecognition softwarepackage.
rpm -V package name Identify missing files in a package orpackage dependency.
rpm -V bash identifies anyfiles missing from the bashpackage.
Note: When using rpm to update software, you might get a message stating: cannot get shared lock on database. When youpdate the rpm database, the program creates a lock on the database to prevent other processes from modifying the database athe same time. To correct the error:
Close any other programs that might be using the rpm database. Check for stale lock files (lock files that were not deleted properly) and remove them.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 45/56
45
VIII. Boot & Shutdown
A boot loader manages the loading of the operating system and allows you tohave multiple operating systems on a single system. Popular Linux boot loader utilities are:
LILO (LInux LOader), the original Linux boot loader. GRUB (GRand Unified Bootloader), is a recent replacement that is gaining in popularity.
PCs use the following process to boot the system:
1. At startup, the BIOS verifies system hardware, then looks for a master boot record (MBR) on a valid
booting disk. Once located, it loads the first program in the MBR (this is the boot loader file).2. The boot loader loads a small piece of code, then looks for the remaining boot loader code. This is thefirst stage of the boot load process.
3. For LILO, the boot loader looks in the MBR for the additional boot information. With GRUB, it can looon the /boot volume for additional boot information. The additional information includes a list opossible operating systems recognized by the boot loader. This is the second stage of the boot loadprocess.
4. After the user has chosen the OS to boot to (or if only one is found), the boot loader locates andbegins loading the corresponding kernel. It also loads the initial RAM disk image (initrd) into memorso the kernel can locate drivers needed to load the kernel.
5. With the kernel and initrd loaded, the boot loader passes control to the kernel.
LILO has a long history of stable operation, and it seems unlikely to be completely replaced bGRUB. However, listed below are some reasons why GRUB has increased in popularity.
GRUB provides an interactive command line during boot up that allows you to do the operationbelow:
o View hardware configurationo Find and view fileso Alter the GRUB configurationo Boot a selected operating system
GRUB offers a complete support system, including the following components:o Web siteo Manualo FAQo Bug trackero Developer mailing list
GRUB can read the ext2 and ext3 filesystems (and not just the MBR), so it can read its configuratiofile from the /boot partition instead of having to store such information on the MBR as LILO does.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 46/56
46
Shutdown Command and Facts.
Turning off the power without executing the proper shutdown procedure to computer can result in data loss and filesystem corruption. Linux provides severadifferent shutdown options. The table below shows common commands for shuttingdown the system.
Use... To...
shutdown -h
nowhalt or
init 0
Shut the system down immediately.
shutdown–
rnow
reboot or
init 6
Shut the system down immediately and reboot.
shutdown -htime shutdown –r
time
Shut the system down in the designated amount of time. Examples:
shutdown -h +5 shuts the system down in five minutes.
shutdown -h 22:00 shuts the system down at 10:00 pm.
shutdown -r +15 reboots the system in 15 minutes.
shutdown -r 24:00 reboots the system at midnight.
shutdown -c Terminate the shutdown process. (You can also press Ctrl + c on the keyboard.)
shutdown -rftime
Reboots the system and skips the fsck utility on reboot (the -f parameter stands for fast). Example: shutdown -r +15 reboots the system in 15 minutes and skips fsck.
shutdown -k Sends a warning message, but doesn't really shut down. If used in combination with -h or -r, it wilterminate the shutdown process after the message is sent.
shutdown -a The system uses the /etc/shutdown.allow file to verify who can shut down the system. The mostcommon use of this switch is to edit the /etc/inittab file and add the -a switch to the CTRL-ALT-DELETEsection. When the switch is present, if the shutdown.allow file exists, shutdown checks to see if alisted user or root is logged on.
If so, the system shuts down.
If not, shutdown is not allowed.
If the file does not exist, there are no restrictions on who can shut down the system.
When you use the shutdown command to power the computer off, the system does the following:
Sends a SIGTERM message to open programs to allow them to close. Notifies logged on users that the shutdown process has initiated and the length of time before shu
down. Blocks users from logging into the system. Uses init and /etc/inittab to shut down processes and the system. The shutdown command execute
the shutdown process listed in inittab.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 47/56
47
IX. Networking.
Many of the network services you run on Linux are administered by xinetd, service known as a super server. A super server listens on behalf of other services tostart and stop them as necessary. Xinetd starts when the system boots up. Itconfiguration file is /etc/xinetd.conf, and most of the daemons it manages are locatein the /etc/xinetd.d directory.
Xinetd has come to replace inetd in modern Linux distributions in large parbecause it is more secure than inetd. For example, unlike inetd which depended o
tcpd to access hosts.allow and hosts.deny, xinetd does not to rely on externaprograms to manage its security; it can access hosts.allow and hosts.deny directlyUsing xinetd, you can also place limits on incoming connections.
There are two ways you can enable services to be managed by the xinetd supeserver. You can either add a section to the /etc/xinetd.conf file describing the service, oyou can create a file containing the service description in the /etc/xinetd.d directory.
The table below describes the most common network services.
Service Description ServerComponent
Client Component Commands and ConfigurationFiles
ApacheWebserver
Used to serve Web pages tocomputers across a network.
httpd Web browser (Mozillais a popular Linux Webbrowser)
/etc/httpd/conf/httpd.conf isthe main configuration file/var/www holds WWW andproxy cache files.
BINDDNSserver
Provides name resolution
services.
named Any application thatneeds to resolvedomain names
nslookupdig
/etc/named.confzone files are stored in the/var/named directory
DHCP Dynamically assigns IP
addresses and other TCP/IPconfiguration information tonetwork hosts.
dhcpd dhcpcddhclientpump (to manageclient connections)
/etc/dhcpd.conf
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 48/56
48
FTP Used to transfer filesacross networks.
ftpd ftp from thecommand line
Web browsersGUI clients
/etc/ftpaccess
NFS Network file service allowsLinux systems to share filesacross a network
nfsd mountcommand toaccess data onstoragedevices
/etc/exportsexportfs -r command to export the shareto the network users
NIS A centralized user databasefor local networkauthentication.
ypservyppasswddypxfrd
ypbind NIS uses multiple files. For username andpassword information, it builds a speciadatabase from your passwd and shadowfiles. When you change your Linux users
you must re-export them to NISThe /var/yp directory holds the NIS userdatabase files.
SMB/Samba Samba is the open sourceserver message block(SMB) service. Windowsuses SMB, so Samba allowsintegration of Linux andWindows file sharing.
smbd andnmbd
smb4k utilityto browsecomputersand shares
The /etc/samba directory stores sambaconfiguration files
smb.conf (main configurationfile)
smbpasswd (stores samba userinformation)
smbmount to mount the smbfs filesystem
smbpasswd -a name to associate Sambausers with established user accounts andchange user passwords.
Squid proxyserver
Allows networked
computers to share oneInternet connection
squid Generally aWeb browser
/etc/squid/squid.conf is the mainconfiguration file.
/var/www holds proxy cache files.
SSH Secure shell providesencrypted communication(replaces telnet)
opensshd ssh (remoteshell)scp (securecopy)sftp (secureFTP)
/etc/ssh directory stores configurationfiles
RADIUS Provides centralized
authentication and
accounting for remoteaccess (dial-in) services.
radiusd Clientsaccessing theserverremotely
/etc/radiusd
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 49/56
49
SendMail Provides e-mailservices.
sendmail Multiple e-mail clients,often integrated with aWeb browser.
/etc/sendmail.cf or /etc/mail/sendmail.cf
configures the server.
/etc/aliases maps mail names to user names.
The .forward file in the user home directoryredirects incoming mail messages to other e-maiaddresses.The /var/mail directory holds user mailbox files(this might be a symbolic link to anotherlocation).
Note: You can manage each service independently, or use the linuxconf tool. Linuxconf is a graphical toothat lets you view and manage many different networking services in a single tool.
NIS Facts
A common way to allow centralized logins is to set up an NIS server. An NIS serveallows you to coordinate common configuration files like /etc/passwd and /etc/shadow acrosseveral Linux machines.
Use ypserv.rpm to install the NIS service. This packet installs the following daemonswhich are the core services to run an NIS server:
ypserv yppasswdd ypxfrd
After you've installed the ypserv.rpm, use the following steps to configure the NISserver:
1. Add the following line to /etc/sysconfig/network: NISDOMAIN=domain_name.2. Start the NIS services. You can do this with one of the following sets of command
at the command line:o chkconfig daemon on (replacing daemonwith ypserv, yppasswdd, or ypxfrd)o /etc/init.d/daemon start (replacing daemon with ypserv, yppasswdd, o
ypxfrd)3. Switch to /usr/lib/yp and run ./ypinit -m to create the yp database.4. Add users to the local passwd file, then run make -C /var/yp to rebuild the y
database from the /usr/lib/yp directory. You can also use the ypmake command.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 50/56
50
After setting up the NIS server and creating the yp database, you need to configurclient computers to use the NIS server for authentication. Use the following steps:
1. Run the Authentication tool from the GUI.2. Identify the domain and NIS server.3. Enter ypbind at the command line to start the NIS client.4. Locate the NIS server by entering ypwhich at the command line.
Remote Access and Administration
Not only can you have multiple users logged on to a computer at a time, yo
can also log in to a computer over the network. This is useful in case you want to copfiles or manage the remote computer. Listed below are common tools that let yoconnect to remote systems.
Tool Command Syntax Examples
Telnet telnet address telnet 192.168.1.12 opens a remote session with the server.
FTP (FileTransferProtocol)
ftp address ftp 192.168.1.13 opens an interactive FTP session with the server, allowingyou to transfer files.
SFTP(SecureFTP)
sftp user @server sftp [email protected] logs in using SSH and provides you a secure FTPsession.
SSH(SecureShell)
ssh server
ssh user @server
ssh -l user hostname
ssh 192.168.1.12
ssh [email protected] logs in and opens a secure remote session (similato Telnet).
ssh -l tsampson my.network.com logs in to my.network.com as the usertsampson.
scp(SecureCopy)
scp source
user @server :destination
scp /sales/report [email protected]:/report securely transfers the reportfile from the local system to the remote computer.
When using Telnet to connect to a remote computer, you cannot log in as theroot user. Instead, log in as another user, then use the su command to switch to throot user within the Telnet session.
The /etc/ftpusers file contains the names of users who do not have ftp login privileges.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 51/56
51
Networking Commands and Files
Linux uses the following files for network configuration information.File or Directory Description
/etc/init.d/network Script file that loads and unloads networking services.
/etc/sysconfig/network-scripts
Network configuration file directory. In this directory, you'll find individual deviceconfiguration files by locating files named ifcfg-device_name (e.g., ifcfg-eth0). You can editthese individual files to modify the following settings:
Boot protocol (static, DHCP, or BootP)
Autoconfiguration information
IP Address, mask, and gateway (for static configurations)
/etc/hosts/etc/resolv.conf
IP address-to-host name files used for name resolution. (A host name is also called a fullyqualified domain name or FQDN.) Entries in the /etc/hosts file need only two fields - the IPaddress followed by the host name. Any entries after these two entries are either aliasesor if preceded by a # sign, a comment about the entry.
/etc/hostname Holds the variables that define the host and domain names.
The table below shows common commands for configuring network settings.
Use... To... Example
service network option Starts, restarts, or stops networkingservices.
service network start
service network restartservice network stop
ifconfig interface
parameters
Common ifconfig
parameters:
address interface's IP address
netmask interface's subnet mask
up activate
interface down deactivate
interface's
Create a static IP configuration. Youcan also start or stop a networkinterface with ifconfig.
ifconfig eth0 192.168.1.1 netmask255.255.255.0 configures a static IP addressand subnet mask for eth0ifconfig eth0 up starts the eth0 device(conversely, down stops the device)
ifup interface Start a network interface. ifup eth1
ifdown interface Stop a network interface. ifdown eth1
route add options target route del options target
Add or delete a static route for thetarget.
route add default gw 192.168.1.1 eth1 addsthe default gateway 192.168.1.1 to eth1.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 52/56
52
Use the following commands to view network configuration information: Use ifconfig to view configuration information for network interfaces. Use route to view the routing table and the default gateway. Use arp to view the ARP cache (MAC address-to-IP address mappings).
X. Security
User Account Security
Listed below are some recommendations to follow in securing user accounts:
Use shadow passwords. Check for an x in the password field of /etc/passwd. If it inot there, use pwconv to enable shadow passwords.
Enforce password expiration to make users change their passwords periodically. Ensure complex passwords are used. Complex passwords:
o Contain six to nine characters (or more)o Contain all of the following:
Upper case letters Lower case letters Numbers Special characters (such as &, $, #, etc.) Alt characters (such as Æ, µ, £, etc.)
o Do not contain recognizable patterns (such as words)o Do not contain personal information (such as the user name)
Lock user accounts that will be inactive for a long period of time. Lock or delete user accounts that are no longer needed. Do not use the root user account for regular tasks. Use the su -c or sudo command
to run commands as the root user, or switch to the root user to complete
administration tasks. Log out of the root user after completing all necessary tasks.
Netwok Security Tools
Linux includes several tools that help you manage network security. Thefollowing table lists several tool types with Linux examples.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 54/56
54
File or Directory Contents/Purpose
/etc/inittab System initialization file that controls the runlevel and the services started at boot.
/etc/rc.d/etc/rc.d/init.d/etc/rc.d/rc0.d
Directories that hold files related to daemons that are started by the inittab file.init.d holds script files that launch servicesrc0.d corresponds to a runlevel and holds links to scripts to start and stop services uponentering the runlevel.
/etc/shutdown.allow File that identifies users who can shut down the system.
/etc/fstab/etc/mtab
Files that identify volume mounts. fstab identifies volumes to mount at boot. mtabidentifies currently-mounted volumes.
/mnt/media
Directories that are used to create mount points to volumes.
/dev Directory that holds device files that are used to configure and access system resources.
/etc/crontab/etc/cron.daily/etc/cron.hourly/etc/cron.weekly/etc/cron.monthly
Files that identify scheduled tasks. The main crontab file launches the other files listed.
/etc/passwd/etc/shadow/etc/group/etc/gshadow
User and group database and password files.
/etc/X11/XF86Config/etc/X11/xorg.conf
XWindows configuration files.
/etc/lilo.conf LILO boot loader configuration file. After editing this file, be sure to run the lilo commandto write changes to the appropriate location.
/etc/grub.conf/boot/grub/grub.conf
GRUB boot loader configuration files. The location of the file depends on your distribution.
/boot Directory that holds files needed for the boot process. Most notably, the compiled kerneis usually in this directory.
/etc/modules.conf/etc/conf.modules/etc/modprobe.conf
Files that identify kernel modules loaded at system startup. The file used depends on thedistribution.
/etc/profile System-wide profile script that runs for all users immediately after login.
/etc/bashrc System-wide script that is used for aliases and functions. Runs after the /etc/profile script./etc/sysconfig/network-scripts
Directory that holds files for network configuration.
/etc/hosts/etc/resolv.conf
Local files used for name resolution.
/etc/inetd.conf/etc/xinetd.conf
Main network configuration file. This file controls starting and stopping networkingservices. Which file is used on your system depends on the distribution.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 55/56
55
/etc/hosts.allow/etc/hosts.deny
Files that identify users who can or cannot use network services.
/proc Virtual file system that holds information about the current system state. View (and in
some cases edit) files in this directory to view and modify the current system state./var/log Directory that holds system messages and events.
/var/log/dmesg/var/log/messages/var/log/boot.log/var/log/boot.messages/tmp/install.log/root/install.log
Common files that record the majority of system messages.
/var/spool Directory that holds spool files used for printing, mail, cron, and other jobs.
Network Troubleshooting
The following table compares some of the tools you can use to troubleshoonetwork communication problems.
Use... To...
ifconfig Show status of each network adapter:
MAC address
IP address and mask
Broadcast address Transmit and receive statistics
ping Test connectivity between two devices ping will keep going, must manually stop it
traceroute Test connectivity between devices, show the path between the two devices
netstat Incoming and outgoing connections. Sessions, ports, and sockets. Who is connected. (Used withthe -a option, netstat also shows all listening and non-listening ports.
netstat –r
route
Show the routing table, which includes the default gateway.
nslookupdig
Resolve IP address from the host name. dig shows expanded output.
service networkrestart
Restarts all networking services on the computer.
ifup interface
ifdown interface
Start or stop a network interface. Use the ifconfig -a command to get the IP configuration (IPaddressing information) for the network interface.
host Retrieve the IP address and other information for a FQDN/host name from a DNS server.
8/6/2019 Linux Project (Final)
http://slidepdf.com/reader/full/linux-project-final 56/56
When a network problem happens, the first step is to identify the affecteusers or computers. If the problem is isolated to a single computer, the problem is wit
the computer configuration, the network connection, or user error.
Try to ping other computers to see if the computer has connectivity to any other computer. If ping to any other host fails, check the link light on the NIC. If the light is on, the compute
has electrical connectivity to the network. Use ifconfig to verify the IP configuration information If ping works, but the user can't access servers on the network, the problem might be use
error in login. Verify the correct user name and password is used. Make sure CAPS lock isn't on(passwords are case sensitive).
If ping works, try contacting the computer by hostname. If nslookup or dig fails, troubleshooname resolution services.
Try it with your own user account. If you can connect, troubleshoot user error or examinresource permissions.
If multiple users on the same network are having the same problem, narrowthe scope of the problem.
Is the problem with accessing a single host or server? If so, troubleshoot the destinationdevice.
Is the problem with accessing any outside network? If so, check the routers connecting you tother networks.
Is the problem with accessing specific destination networks? If so, run traceroute to identifthe spot in the path where the problem starts.
If all users are having troubles connecting to a specific service (such as a file server):
Ping the destination server. If ping fails, troubleshoot the server or the connection. Make sure the server is turned on
check the hardware connection, and validate the IP configuration. If ping succeeds, this means the server can be contacted. However, the service might not b
responding. Verify that the daemon for the service has been started.