xiv 11 System Administration: Core Concepts 407 12 Files, Directories, and Filesystems 501 13 Finding, Downloading, and Installing Software 531 14 Printing with CUPS 559 15 Building a Li
Trang 1ptg6843614
Trang 2Guide to Fedora and Red Hat Enterprise Linux
“Since I’m in an educational environment, I found the content of Sobell’s
book to be right on target and very helpful for anyone managing Linux
in the enterprise His style of writing is very clear He builds up to the
chapter exercises, which I find to be relevant to real-world scenarios a
user or admin would encounter An IT/IS student would find this book a
valuable complement to their education The vast amount of
informa-tion is extremely well balanced and Sobell manages to present the
con-tent without complicated asides and meandering prose This is a ‘must
have’ for anyone managing Linux systems in a networked environment
or anyone running a Linux server I would also highly recommend it to
an experienced computer user who is moving to the Linux platform.”
—Mary Norbury
IT Director Barbara Davis Center University of Colorado at Denver from a review posted on slashdot.org
“I had the chance to use your UNIX books when I when was in college
years ago at Cal Poly, San Luis Obispo, CA I have to say that your
books are among the best! They’re quality books that teach the
theo-retical aspects and applications of the operating system.”
—Benton Chan
IS Engineer
“The book has more than lived up to my expectations from the many
reviews I read, even though it targets FC2 I have found something very
rare with your book: It doesn’t read like the standard technical text, it
reads more like a story It’s a pleasure to read and hard to put down
Did I say that?! :-)”
—David Hopkins Business Process Architect
“Thanks for your work and for the book you wrote There are really few
books that can help people to become more efficient administrators of
different workstations We hope (in Russia) that you will continue
bringing us a new level of understanding of Linux/UNIX systems.”
—Anton Petukhov
®
Trang 3“Mark Sobell has written a book as approachable as it is authoritative.”
—Jeffrey Bianchine Advocate, Author, Journalist
“Excellent reference book, well suited for the sysadmin of a Linux
clus-ter, or the owner of a PC contemplating installing a recent stable Linux
Don’t be put off by the daunting heft of the book Sobell has striven to
be as inclusive as possible, in trying to anticipate your system
adminis-tration needs.”
—Wes Boudville Inventor
“A Practical Guide to Red Hat ® Linux ®is a brilliant book Thank you
Mark Sobell.”
—C Pozrikidis University of California at San Diego
“This book presents the best overview of the Linux operating system that
I have found [It] should be very helpful and understandable no
mat-ter what the reader’s background: traditional UNIX user, new Linux
devotee, or even Windows user Each topic is presented in a clear,
com-plete fashion and very few assumptions are made about what the reader
knows The book is extremely useful as a reference, as it contains a
70-page glossary of terms and is very well indexed It is organized in
such a way that the reader can focus on simple tasks without having to
wade through more advanced topics until they are ready.”
—Cam Marshall Marshall Information Service LLC Member of Front Range UNIX Users Group [FRUUG]
Boulder, Colorado
“Conclusively, this is THE book to get if you are a new Linux user and
you just got into RH/Fedora world There’s no other book that
dis-cusses so many different topics and in such depth.”
—Eugenia Loli-Queru Editor in Chief OSNews.com
Trang 4Praise for Other Books by Mark G Sobell
“This book is a very useful tool for anyone who wants to ‘look under
the hood’ so to speak, and really start putting the power of Linux to
work What I find particularly frustrating about man pages is that they
never include examples Sobell, on the other hand, outlines very clearly
what the command does and then gives several common,
easy-to-understand examples that make it a breeze to start shell programming
on one’s own As with Sobell’s other works, this is simple,
straight-forward, and easy to read It’s a great book and will stay on the shelf at
easy arm’s reach for a long time.”
—Ray Bartlett Travel Writer
“Overall I found this book to be quite excellent, and it has earned a spot
on the very front of my bookshelf It covers the real ‘guts’ of Linux—
the command line and its utilities—and does so very well Its strongest
points are the outstanding use of examples, and the Command
Refer-ence section Highly recommended for Linux users of all skill levels
Well done to Mark Sobell and Prentice Hall for this outstanding book!”
—Dan Clough Electronics Engineer and Slackware Linux User
“Totally unlike most Linux books, this book avoids discussing
every-thing via GUI and jumps right into making the power of the command
line your friend.”
—Bjorn Tipling Software Engineer ask.com
“This book is the best distro-agnostic, foundational Linux reference I’ve
ever seen, out of dozens of Linux-related books I’ve read Finding this
book was a real stroke of luck If you want to really understand how to
get things done at the command line, where the power and flexibility of
free UNIX-like OSes really live, this book is among the best tools you’ll
find toward that end.”
—Chad Perrin Writer, TechRepublic
Trang 5“I currently own one of your books, A Practical Guide to Linux I
believe this book is one of the most comprehensive and, as the title
says, practical guides to Linux I have ever read I consider myself a
novice and I come back to this book over and over again.”
—Albert J Nguyen
“Thank you for writing a book to help me get away from Windows XP
and to never touch Windows Vista The book is great; I am learning a lot
of new concepts and commands Linux is definitely getting easier to use.”
—James Moritz
“I am so impressed by how Mark Sobell can approach a complex topic
in such an understandable manner His command examples are
espe-cially useful in providing a novice (or even an advanced) administrator
with a cookbook on how to accomplish real-world tasks on Linux He
is truly an inspired technical writer!”
—George Vish II Senior Education Consultant Hewlett-Packard Company
“Overall, I think it’s a great, comprehensive Ubuntu book that’ll be a
valuable resource for people of all technical levels.”
—John Dong Ubuntu Forum Council Member Backports Team Leader
“The JumpStart sections really offer a quick way to get things up and
running, allowing you to dig into the details of the book later.”
—Scott Mann Aztek Networks
“I would so love to be able to use this book to teach a class about not
just Ubuntu or Linux but about computers in general It is thorough
and well written with good illustrations that explain important
con-cepts for computer usage.”
—Nathan Eckenrode New York Local Community Team
Trang 6“Ubuntu is gaining popularity at the rate alcohol did during Prohibition,
and it’s great to see a well-known author write a book on the latest and
greatest version Not only does it contain Ubuntu-specific information,
but it also touches on general computer-related topics, which will help
the average computer user to better understand what’s going on in the
background Great work, Mark!”
—Daniel R Arfsten Pro/ENGINEER Drafter/Designer
“I read a lot of Linux technical information every day, but I’m rarely
impressed by tech books I usually prefer online information sources
instead Mark Sobell’s books are a notable exception They’re clearly
written, technically accurate, comprehensive, and actually enjoyable
to read.”
—Matthew Miller Senior Systems Analyst/Administrator
BU Linux Project Boston University Office
of Information Technology
“This is well written, clear, comprehensive information for the Linux
user of any type, whether trying Ubuntu on for the first time and
want-ing to know a little about it, or uswant-ing the book as a very good reference
when doing something more complicated like setting up a server This
book’s value goes well beyond its purchase price and it’ll make a great
addition to the Linux section of your bookshelf.”
—Linc Fessenden Host of The LinuxLink TechShow tllts.org
“The author has done a very good job at clarifying such a detail-oriented
operating system I have extensive Unix and Windows experience and this
text does an excellent job at bridging the gaps between Linux, Windows,
and Unix I highly recommend this book to both ‘newbs’ and experienced
users Great job!”
—Mark Polczynski Information Technology Consultant
Trang 7“When I first started working with Linux just a short 10 years or so ago,
it was a little more difficult than now to get going Now, someone
new to the community has a vast array of resources available on the
web, or if they are inclined to begin with Ubuntu, they can literally find
almost every single thing they will need in the single volume of Mark
Sobell’s A Practical Guide to Ubuntu Linux ®
“I’m sure this sounds a bit like hyperbole Everything a person would
need to know? Obviously not everything, but this book, weighing in at
just under 1200 pages, covers so much so thoroughly that there won’t
be much left out From install to admin, networking, security, shell
scripting, package management, and a host of other topics, it is all
there GUI and command line tools are covered There is not really any
wasted space or fluff, just a huge amount of information There are
screen shots when appropriate but they do not take up an inordinate
amount of space This book is information-dense.”
—JR Peck Editor GeekBook.org
“I have been wanting to make the jump to Linux but did not have the
guts to do so—until I saw your familiarly titled A Practical Guide to
Red Hat ® Linux ® at the bookstore I picked up a copy and am eagerly
looking forward to regaining my freedom.”
—Carmine Stoffo Machine and Process Designer
to pharmaceutical industry
“I am currently reading A Practical Guide to Red Hat ® Linux ® and am
finally understanding the true power of the command line I am new to
Linux and your book is a treasure.”
—Juan Gonzalez
“Overall, A Practical Guide to Ubuntu Linux ® by Mark G Sobell
pro-vides all of the information a beginner to intermediate user of Linux
would need to be productive The inclusion of the Live DVD of the
Gutsy Gibbon release of Ubuntu makes it easy for the user to test-drive
Linux without affecting his installed OS I have no doubts that you will
consider this book money well spent.”
—Ray Lodato Slashdot contributor www.slashdot.org
Trang 8A Practical Guide to Fedora and
Red Hat Enterprise Linux
SIXTH EDITION
¥
Trang 9This page intentionally left blank
Trang 10A Practical Guide to Fedora and
Red Hat Enterprise Linux
SIXTH EDITION
Mark G Sobell
Upper Saddle River, NJ • Boston • Indianapolis • San Francisco
New York • Toronto • Montreal • London • Munich • Paris • Madrid
Capetown • Sydney • Tokyo • Singapore • Mexico City
¥
Trang 11Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where
those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed
with initial capital letters or in all capitals.
The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any
kind and assume no responsibility for errors or omissions No liability is assumed for incidental or consequential damages in
connection with or arising out of the use of the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may
include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and
branding interests For more information, please contact:
U.S Corporate and Government Sales
Visit us on the Web: informit.com/ph
Library of Congress Cataloging-in-Publication Data
Copyright © 2012 Mark G Sobell
All rights reserved Printed in the United States of America This publication is protected by copyright, and permission must
be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any
form or by any means, electronic, mechanical, photocopying, recording, or likewise To obtain permission to use material
from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper
Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-13-275727-0
ISBN-10: 0-13-275727-3
Text printed in the United States on recycled paper at Edwards Brothers in Ann Arbor, Michigan.
First printing, August 2011
Trang 13This page intentionally left blank
Trang 14PART II Getting Started with Fedora/RHEL 87
4 Introduction to Fedora and Red Hat Enterprise Linux 89
5 The Linux Utilities 145
6 The Linux Filesystem 185
7 The Shell 225
PART III Digging into Fedora/RHEL 255
8 Linux GUIs: X and GNOME 257
9 The Bourne Again Shell 279
10 Networking and the Internet 359
Trang 15xiv
11 System Administration: Core Concepts 407
12 Files, Directories, and Filesystems 501
13 Finding, Downloading, and Installing Software 531
14 Printing with CUPS 559
15 Building a Linux Kernel 583
16 Administration Tasks 601
17 Configuring and Monitoring a LAN 645
PART V Using Clients and Setting Up Servers 671
18 OpenSSH: Secure Network Communication 673
19 F TP: Transferring Files Across a Network 701
20 sendmail: Setting Up Mail Servers, Clients, and More 729
21 NIS and LDAP 759
22 NFS: Sharing Directory Hierarchies 791
23 Samba: Linux and Windows File and Printer Sharing 817
24 DNS/BIND: Tracking Domain Names and Addresses 845
25 system-config-firewall and iptables: Setting Up a Firewall 891
26 Apache (httpd): Setting Up a Web Server 917
27 Programming the Bourne Again Shell 969
28 The Perl Scripting Language 1057
Trang 16Chapter 1: Welcome to Linux 1
The History of UNIX and GNU–Linux 2
The Heritage of Linux: UNIX 2
Fade to 1983 3
Next Scene, 1991 4
The Code Is Free 5
Have Fun! 6
What Is so Good About Linux? 6
Why Linux Is Popular with Hardware Companies and Developers 9
Linux Is Portable 10
The C Programming Language 10
Overview of Linux 11
Linux Has a Kernel Programming Interface 11
Linux Can Support Many Users 12
Linux Can Run Many Tasks 12
Linux Provides a Secure Hierarchical Filesystem 12
The Shell: Command Interpreter and Programming Language 14
A Large Collection of Useful Utilities 15
Interprocess Communication 16
System Administration 16
Trang 17xvi
Additional Features of Linux 16GUIs: Graphical User Interfaces 16(Inter)Networking Utilities 17Software Development 17Conventions Used in This Book 18Chapter Summary 20
Exercises 20
Chapter 2: Installation Overview 25
The Desktop Live CD and the Install DVD 26More Information 27
Planning the Installation 28Considerations 28Requirements 28Processor Architecture 30Interfaces: Installer and Installed System 31Which Are You Installing: Fedora or Red Hat Enterprise Linux? 32Fedora/RHEL Releases 33
Fedora Standard Versions 33Fedora Spins 33
Installing a Fresh Copy or Upgrading an Existing Fedora/RHEL System? 34Setting Up the Hard Disk 34
Burning the CD/DVD 48Gathering Information About the System 48Chapter Summary 49
Exercises 50Advanced Exercises 50
Chapter 3: Step-by-Step Installation 51
Running a Fedora Live Session 52Booting the System 53Installing Fedora/RHEL 54
Trang 18xvii
The Anaconda Installer 58
Firstboot: When You Reboot 65
Initializing Databases and Updating the System 67
Installation Tasks 67
Modifying Boot Parameters (Options) 67
Using Disk Druid to Partition the Disk 71
palimpsest: The GNOME Disk Utility 77
Using the Kickstart Configurator 81
Setting Up a Dual-Boot System 82
gnome-control-center/Displays: Configures the Display 85
Chapter Summary 85
Exercises 86
Advanced Exercises 86
Chapter 4: Introduction to Fedora and Red Hat
Enterprise Linux 89
Curbing Your Power (Superuser/root Privileges) 90
A Tour of the Fedora/RHEL Desktop 90
Logging In on the System 91
Configuring Fallback Mode (Fedora) 92
Installing and Using gnome-tweak-tool (Fedora) 94
Introduction to the Desktop 95
Launching Programs from the Desktop 96
Switching Workspaces 98
Setting Personal Preferences 99
Mouse Preferences 101
Working with Windows 102
Using Nautilus to Work with Files 102
Getting the Most Out of the Desktop 112
GNOME Desktop Terminology 112
Trang 19The ––help Option 131HOWTOs: Finding Out How Things Work 131Getting Help 132
More About Logging In 134The Login Screen 134What to Do if You Cannot Log In 135Logging In Remotely: Terminal Emulators, ssh, and Dial-Up Connections 135Logging In from a Terminal (Emulator) 136
Changing Your Password 137Using Virtual Consoles 138Working from the Command Line 139Correcting Mistakes 139
Repeating/Editing Command Lines 141Chapter Summary 142
Exercises 143Advanced Exercises 144
Chapter 5: The Linux Utilities 145
Special Characters 146Basic Utilities 147ls: Lists the Names of Files 148cat: Displays a Text File 148rm: Deletes a File 148less Is more: Display a Text File One Screen at a Time 149hostname: Displays the System Name 149
Working with Files 149
cp: Copies a File 149mv: Changes the Name of a File 150lpr: Prints a File 151
grep: Searches for a String 152head: Displays the Beginning of a File 152tail: Displays the End of a File 153
sort: Displays a File in Order 154uniq: Removes Duplicate Lines from a File 154diff: Compares Two Files 154
file: Identifies the Contents of a File 156
Trang 20xix
| (Pipe): Communicates Between Processes 156
Four More Utilities 157
echo: Displays Text 157
date: Displays the Time and Date 158
script: Records a Shell Session 158
unix2dos: Converts Linux and Macintosh Files to Windows Format 159
Compressing and Archiving Files 159
bzip2: Compresses a File 160
bzcat and bunzip2: Decompress a File 161
gzip: Compresses a File 161
tar: Packs and Unpacks Archives 162
Locating Utilities 164
which and whereis: Locate a Utility 164
locate: Searches for a File 166
Displaying User and System Information 166
who: Lists Users on the System 166
finger: Lists Users on the System 167
w: Lists Users on the System 168
Communicating with Other Users 170
write: Sends a Message 170
mesg: Denies or Accepts Messages 170
Ending the Editing Session 179
The compatible Parameter 179
Chapter Summary 179
Exercises 182
Advanced Exercises 183
Chapter 6: The Linux Filesystem 185
The Hierarchical Filesystem 186
Directory Files and Ordinary Files 187
Filenames 188
The Working Directory 190
Your Home Directory 191
Pathnames 191
Absolute Pathnames 192
Relative Pathnames 193
Trang 21xx
Working with Directories 194mkdir: Creates a Directory 194cd: Changes to Another Working Directory 196rmdir: Deletes a Directory 197
Using Pathnames 198
mv,cp: Move or Copy Files 198mv: Moves a Directory 199Important Standard Directories and Files 199Access Permissions 202
ls –l: Displays Permissions 202chmod: Changes Access Permissions 203Setuid and Setgid Permissions 205Directory Access Permissions 207ACLs: Access Control Lists 208Enabling ACLs 209Working with Access Rules 209Setting Default Rules for a Directory 212Links 213
Hard Links 214Symbolic Links 216rm: Removes a Link 218Chapter Summary 219Exercises 221
Advanced Exercises 222
Chapter 7: The Shell 225
The Command Line 226Syntax 226
Processing the Command Line 229Executing a Command 231Editing the Command Line 231Standard Input and Standard Output 232The Screen as a File 232
The Keyboard and Screen as Standard Input and Standard Output 233Redirection 234
Pipes 239Running a Command in the Background 242Filename Generation/Pathname Expansion 244
The ? Special Character 245
The* Special Character 246
The [ ] Special Characters 247Builtins 249
Chapter Summary 250Utilities and Builtins Introduced in This Chapter 250Exercises 251
Trang 22xxi
Chapter 8: Linux GUIs: X and GNOME 257
X Window System 258
Using X 260
Desktop Environments/Managers 265
The Nautilus File Browser Window 266
The View Pane 267
Pick a Font Window 273
Pick a Color Window 274
Run Application Window 274
Searching for Files 274
GNOME Terminal Emulator/Shell 276
Commands That Are Symbols 285
Redirecting Standard Error 285
Writing a Simple Shell Script 288
Separating and Grouping Commands 292
Job Control 296
Manipulating the Directory Stack 298
Parameters and Variables 301
Variables That Control History 319
Re-executing and Editing Commands 320
The Readline Library 328
Trang 23xxii
Aliases 334Single Versus Double Quotation Marks in Aliases 335Examples of Aliases 336
Functions 338Controlling bash: Features and Options 340Command-Line Options 340
Shell Features 341Processing the Command Line 344History Expansion 345Alias Substitution 345Parsing and Scanning the Command Line 345Command-Line Expansion 345
Chapter Summary 354Exercises 356
Advanced Exercises 357
Chapter 10: Networking and the Internet 359
Introduction to Networking 360Types of Networks and How They Work 362Broadcast Networks 362
Point-to-Point Networks 363Switched Networks 363LAN: Local Area Network 364WAN: Wide Area Network 367Internetworking Through Gateways and Routers 367Network Protocols 370
IPv4 372IPv6 373Host Address 376CIDR: Classless Inter-Domain Routing 380Hostnames 380
Communicate Over a Network 381finger: Displays Information About Remote Users 381Mailing List Servers 382
Network Utilities 382Trusted Hosts 382OpenSSH Tools 383telnet: Logs In on a Remote System 383ftp: Transfers Files Over a Network 385ping: Tests a Network Connection 386traceroute: Traces a Route Over the Internet 387host and dig: Query Internet Nameservers 388whois: Looks Up Information About an Internet Site 388
Trang 24xxiii
Distributed Computing 390
The Client/Server Model 390
DNS: Domain Name Service 391
Chapter 11: System Administration: Core Concepts 407
Running Commands with root Privileges 409
The Special Powers of a Privileged User 410
Gaining root Privileges 410
Usingsu to Gain root Privileges 413
Usingsudo to Gain root Privileges 415
sudoers: Configuring sudo 419
Locking the root Account (Removing the root Password) 425
consolehelper: Allows an Ordinary User to Run a Privileged Command 425
The init Daemon 426
The systemd init Daemon (Fedora) 426
The Upstart init Daemon (RHEL) 436
SysVinit (rc) Scripts: Start and Stop System Services (Fedora/RHEL) 442
Trang 25xxiv
Rescue Installed System 457Securing a System 458Avoiding a Trojan Horse 458SELinux 459
System Administration Tools 469Textual Administration Utilities 469Graphical Configuration Tools 475Setting Up a Server 477
Standard Rules in Configuration Files 478rpcinfo: Displays Information About rpcbind 480
The xinetd Superserver 481Securing a Server 484DHCP: Configures Network Interfaces 489More Information 490
How DHCP Works 490DHCP Client 491DHCP Server 491
nsswitch.conf: Which Service to Look at First 494Information 494
Methods 495Search Order 495Action Items 495
compat Method: ± in passwd, group, and shadow Files 496Getting Help 497
Chapter Summary 497Exercises 498
Advanced Exercises 499
Chapter 12: Files, Directories, and Filesystems 501
Important Files and Directories 502File Types 514
Ordinary Files, Directories, Links, and Inodes 515Device Special Files 515
Filesystems 519mount: Mounts a Filesystem 520umount: Unmounts a Filesystem 523
fstab: Keeps Track of Filesystems 524fsck: Checks Filesystem Integrity 525tune2fs: Changes Filesystem Parameters 526Chapter Summary 528
Exercises 528
Trang 26JumpStart: Installing and Removing Packages Using yum 534
Finding the Package That Holds an Application or File You Need 537
yum: Keeps the System Up-to-Date 538
Updating Packages 539
yum Commands 540
yum Groups 540
Downloading RPM Package Files with yumdownloader 541
yum.conf: Configures yum 542
yum Repositories 543
BitTorrent 545
RPM: The RPM Package Manager 547
Querying Packages and Files 548
Installing, Upgrading, and Removing Packages 550
Installing a Linux Kernel Binary 551
Installing Non-rpm Software 551
The /opt and /usr/local Directories 551
GNU Configure and Build System 552
Keeping Software Up-to-Date 553
Bugs 553
Errata 554
Red Hat Network (RHEL) 554
wget: Downloads Files Noninteractively 555
Fedora/RHEL Configures a Local Printer Automatically 562
JumpStart I: Configuring a Printer Using system-config-printer 562
Configuration Selections 563
JumpStart II: Setting Up a Local or Remote Printer 565
Working with the CUPS Web Interface 568
Configuring Printers 570
Modifying a Printer 570
The CUPS Web Interface 571
CUPS on the Command Line 572
Sharing CUPS Printers 576
Trang 27xxvi
Traditional UNIX Printing 577Print from Windows 579Print Using CUPS 579Print Using Samba 580Printing to Windows 581Chapter Summary 581Exercises 582
Advanced Exercises 582
Chapter 15: Building a Linux Kernel 583
Downloading, Installing, and Prepping the Kernel Source Code 585Prerequisites 585
More Information 585Downloading the Source Code 585Installing the Source Code 587Prepping the Source Code 587Configuring and Compiling the Linux Kernel 588Labeling the Kernel 588
.config: Configures the Kernel 589
Customizing a Kernel 590Cleaning the Source Tree 592Copying the Configuration File 593Compiling a Kernel Image File and Loadable Modules 593Using Loadable Kernel Modules 593
Installing the Kernel, Modules, and Associated Files 594GRUB: The Linux Boot Loader 595
Configuring GRUB 596grub-install: Installs the MBR and GRUB Files 597dmesg: Displays Kernel Messages 597
Chapter Summary 598Exercises 598
Advanced Exercises 599
Chapter 16: Administration Tasks 601
Configuring User and Group Accounts 602system-config-users: Manages User Accounts 602Managing User Accounts from the Command Line 604Backing Up Files 605
Choosing a Backup Medium 606Backup Utilities 607
Performing a Simple Backup 610Scheduling Tasks 611
Trang 28xxvii
System Reports 615
vmstat: Reports Virtual Memory Statistics 615
top: Lists Processes Using the Most Resources 616
Maintaining the System 617
parted: Reports on and Partitions a Hard Disk 617
logrotate: Manages Log Files 621
rsyslogd: Logs System Messages 623
Keeping Users Informed 625
The my.cnf Configuration File 638
Working with MySQL 638
Chapter Summary 643
Exercises 643
Advanced Exercises 644
Setting Up the Hardware 646
Connecting the Computers 646
Routers 647
NIC: Network Interface Card 647
Tools 648
Configuring the Systems 650
NetworkManager: Configures Network Connections 651
The NetworkManager Applet Right-Click Menu 651
Basic Cacti Administration 663
Setting Up a Remote Data Source 664
More Information 668
Chapter Summary 668
Exercises 669
Advanced Exercises 669
Trang 29More Information 677Running the ssh,scp, and sftp OpenSSH Clients 677Prerequisites 677
JumpStart: Using ssh and scp to Connect to an OpenSSH Server 677Configuring OpenSSH Clients 678
ssh: Logs in or Executes Commands on a Remote System 681scp: Copies Files to and from a Remote System 683
sftp: A Secure FTP Client 685
~/.ssh/config and /etc/ssh/ssh_config Configuration Files 686
Setting Up an OpenSSH Server (sshd) 688Prerequisites 688
Notes 688JumpStart: Starting an OpenSSH Server 688Authorized Keys: Automatic Login 689ssh-agent: Holds Your Private Keys 691Command-Line Options 692
/etc/ssh/sshd_config Configuration File 692Troubleshooting 695
Tunneling/Port Forwarding 696Forwarding X11 696Port Forwarding 697Chapter Summary 698Exercises 699
Advanced Exercises 699
Chapter 19 F TP: Transferring Files Across a
Introduction to FTP 702Security 702
FTP Connections 703FTP Clients 703
Trang 30JumpStart I: Configuring sendmail on a Client 733
JumpStart II: Configuring sendmail on a Server 734
Working with sendmail Messages 735
Mail Logs 736
Aliases and Forwarding 736
Related Programs 738
Configuring sendmail 739
The sendmail.mc and sendmail.cf Files 739
Other Files in /etc/mail 741
Trang 31Chapter Summary 756Exercises 757
Advanced Exercises 757
Chapter 21: NIS and LDAP 759
Introduction to NIS 760How NIS Works 760More Information 763Running an NIS Client 763Prerequisites 763Notes 764Configuring an NIS Client 764Troubleshooting the Client 766yppasswd: Changes NIS Passwords 767Setting Up an NIS Server 769
Prerequisites 769Notes 770Configuring the Server 770Troubleshooting the Server 775
yppasswdd: The NIS Password Update Daemon 775
LDAP 776More Information 778Setting Up an LDAP Server 779Prerequisites 779
Note 779Step-by-Step Setup 779Tools for Working with LDAP 784Evolution Mail 785
Chapter Summary 788Exercises 789
Advanced Exercises 789
Chapter 22: NFS: Sharing Directory Hierarchies 791
Introduction to NFS 793More Information 795
Trang 32xxxi
Running an NFS Client 795
Prerequisites 796
JumpStart I: Mounting a Remote Directory Hierarchy 796
mount: Mounts a Directory Hierarchy 797
JumpStart II: Configuring an NFS Server Using system-config-nfs (Fedora) 802
Manually Exporting a Directory Hierarchy 804
Where the System Keeps NFS Mount Information 808
exportfs: Maintains the List of Exported Directory Hierarchies 809
Samba Users, User Maps, and Passwords 820
smbpasswd and pdbedit: Work with Samba Users and Passwords 821
Running Samba Clients 822
Prerequisites 822
Working with Shares from Linux 823
Working with Shares from Windows 825
Setting Up a Samba Server 826
Prerequisites 826
JumpStart: Configuring a Samba Server Using system-config-samba
(Fedora) 827
swat: Configures a Samba Server 830
smb.conf: Manually Configuring a Samba Server 834
Troubleshooting 840
Chapter Summary 843
Exercises 844
Advanced Exercises 844
Trang 33Queries 850Servers 850Resource Records 851DNS Queries and Responses 855Reverse Name Resolution 856How DNS Works 857
More Information 858Setting Up a DNS Server 858Prerequisites 858Notes 859JumpStart I: Setting Up a DNS Cache 860JumpStart II: Setting Up a Domain Using system-config-bind (Fedora) 861Configuring a DNS Server 866
named.conf: The named Configuration File 866Zone Files 868
Setting Up a DNS Cache 869DNS Glue Records 874TSIGs: Transaction Signatures 875Running BIND in a chroot Jail 877Troubleshooting 878
Setting Up Different Types of DNS Servers 879
Chapter 25: system-config-firewall and iptables : Setting Up a Firewall 891
JumpStart: Building a Firewall Using system-config-firewall 893Introduction to iptables 895
More Information 898Prerequisites 898Notes 899Anatomy of an iptables Command 900
Trang 34Copying Rules to and from the Kernel 908
system-config-firewall: Generates a Set of Rules 909
Sharing an Internet Connection Using NAT 910
Connecting Several Clients to a Single Internet Connection 911
Connecting Several Servers to a Single Internet Connection 913
Directives I: Directives You Might Want to Modify as You Get Started 925
Contexts and Containers 930
Directives II: Advanced Directives 935
The Fedora/RHEL httpd.conf File 947
Section 1: Global Environment 948
Section 2: Main Server Configuration 949
Section 3: Virtual Hosts 950
Trang 35xxxiv
webalizer: Analyzes Web Traffic 963MRTG: Monitors Traffic Loads 964Error Codes 964
Chapter Summary 965Exercises 965
Advanced Exercises 966
type: Displays Information About a Command 1019read: Accepts User Input 1019
exec: Executes a Command or Redirects File Descriptors 1022trap: Catches a Signal 1025
kill: Aborts a Process 1028getopts: Parses Options 1028
A Partial List of Builtins 1031Expressions 1032
Arithmetic Evaluation 1032Logical Evaluation (Conditional Expressions) 1033
Trang 36A Recursive Shell Script 1041
The quiz Shell Script 1044
Trang 37xxxvi
Appendix A: Regular Expressions 1105
Characters 1106Delimiters 1106Simple Strings 1106Special Characters 1106Periods 1107Brackets 1107Asterisks 1108Carets and Dollar Signs 1108Quoting Special Characters 1109Rules 1109
Longest Match Possible 1109Empty Regular Expressions 1110Bracketing Expressions 1110
The Replacement String 1110Ampersand 1111
Quoted Digit 1111Extended Regular Expressions 1111Appendix Summary 1113
Appendix B: Help 1115
Solving a Problem 1116Finding Linux-Related Information 1117Documentation 1117
Useful Linux Sites 1118Linux Newsgroups 1119Mailing Lists 1119Words 1120Software 1120Office Suites and Word Processors 1122Specifying a Terminal 1122
Appendix C: Security 1125
Encryption 1126Public Key (Asymmetric) Encryption 1127Symmetric Key Encryption 1129
Encryption Implementation 1130GnuPG/PGP 1130
File Security 1131
Trang 38xxxvii
Email Security 1131
MTAs (Mail Transfer Agents) 1132
MUAs (Mail User Agents) 1132
Network Security 1132
Network Security Solutions 1133
Network Security Guidelines 1133
Host Security 1135
Login Security 1136
Remote Access Security 1137
Viruses and Worms 1138
Trang 39This page intentionally left blank
Trang 40xxxix
JumpStarts
JumpStarts get you off to a quick start when you need to use a client or set up a server
Once you have the client or server up and running, you can refine its configuration
using the information presented in the sections following each JumpStart
yum (Software Packages)
Installing and Removing Packages Using yum 534
CUPS (Printing)
Configuring a Printer Using system-config-printer 562
Setting Up a Local or Remote Printer 565
MySQL (Database)
Setting Up MySQL 636
OpenSSH (Secure Communication)
Usingssh and scp to Connect to an OpenSSH Server 677
Starting an OpenSSH Server 688
FTP (Download and Upload Files)
Downloading Files Using ftp 704
Starting a vsftpd FTP Server 713