Tải bản đầy đủ (.pdf) (891 trang)

Red hat fedora linux 2 all in one desk reference for dummies (2004)

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (17.27 MB, 891 trang )

by Naba Barkakati
Red Hat
®
Fedora

Linux
®
2
ALL-IN-ONE DESK REFERENCE
FOR
DUMmIES

by Naba Barkakati
Red Hat
®
Fedora

Linux
®
2
ALL-IN-ONE DESK REFERENCE
FOR
DUMmIES

Red Hat
®
Fedora

Linux


®
2 All-in-One Desk Reference For Dummies
®
Published by
Wiley Publishing, Inc.
111 River Street
Hoboken, NJ 07030-5774
Copyright © 2004 by Wiley Publishing, Inc., Indianapolis, Indiana
Published by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or
by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permit-
ted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written
permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the
Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600.
Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing,
Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, e-mail:

Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the
Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, and related trade
dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the
United States and other countries, and may not be used without written permission. Red Hat and Fedora
are trademarks or registered trademarks of Red Hat, Inc. Linux is a registered trademark of Linus
Torvalds. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not
associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS
OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND
SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A
PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERI-
ALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS

WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL,
ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES
OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR
SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS
REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES
NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR
WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT
INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK
WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services or to obtain technical support, please con-
tact our Customer Care Department within the U.S. at 800-762-2974, outside the U.S. at 317-572-3993, or
fax 317-572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may
not be available in electronic books.
Library of Congress Control Number is available from the publisher.
ISBN: 0-7645-6793-4
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
1O/SR/QX/QU/IN
About the Author
Naba Barkakati is an electrical engineer and a successful computer-book
author who has experience in a wide variety of systems, ranging from MS-DOS
and Windows to UNIX and Linux. He bought his first personal computer — an
IBM PC-AT — in 1984 after graduating with a PhD in electrical engineering from
the University of Maryland at College Park. While pursuing a full-time career in
engineering, Naba dreamed of writing software for the emerging PC software
market. As luck would have it, instead of building a software empire like
Microsoft, he ended up writing successful computer books. Currently, Naba is
a Senior Level Technologist at the Center for Technology and Engineering in
the U.S. General Accounting Office.

Over the past 15 years, Naba has written over 25 computer books on a number
of topics ranging from Windows programming with C++ to Linux. He has
authored several bestselling titles, such as The Waite Group’s Turbo C++ Bible,
Object-Oriented Programming in C++, X Window System Programming, Visual
C++ Developer’s Guide, Borland C++ 4 Developer’s Guide, and Linux Secrets. His
books have been translated into many languages, including Spanish, French,
Polish, Greek, Italian, Chinese, Japanese, and Korean. Naba’s most recent book
is Red Hat Linux 9 Professional Secrets, also published by Wiley.
Naba lives in North Potomac, Maryland, with his wife Leha, and their chil-
dren, Ivy, Emily, and Ashley.
Dedication
I would like to dedicate this book to my wife Leha, and daughters Ivy, Emily,
and Ashley.
Author’s Acknowledgments
I am grateful to Terri Varveris for getting me started on this book — a set of
nine quick reference guides on all aspects of Red Hat Linux. As the project
editor, Linda Morris guided me through the manuscript-submission process
and kept everything moving. I appreciate the guidance and support that Terri
and Linda gave me during this project.
I would like to thank Jason Luster for reviewing the manuscript for technical
accuracy and providing many useful suggestions for improving the book’s
content.
Thanks to everyone at Wiley Publishing for transforming my raw manuscript
into this well-edited and beautifully packaged book.
Of course, there would be no reason for this book if it were not for Linux. For
this, we have Linus Torvalds and the legions of Linux developers around the
world to thank. Thanks to Red Hat for providing beta copies of Red Hat Linux
and the publisher’s edition CDs that are bundled with this book.
Finally, and as always, my greatest thanks go to my wife, Leha, and our

daughters, Ivy, Emily, and Ashley — it is their love and support that keeps me
going. Thanks for being there!
Publisher’s Acknowledgments
We’re proud of this book; please send us your comments through our online registration form
located at
www.dummies.com/register/.
Some of the people who helped bring this book to market include the following:
Acquisitions, Editorial, and
Media Development
Project Editor: Linda Morris
Acquisitions Editor: Terri Varveris
Copy Editor: Rebecca Senninger
Technical Editor: Jason Luster
Editorial Manager: Leah Cameron
Permissions Editor: Laura Moss
Media Development Specialist: Travis Silvers
Media Development Manager:
Laura VanWinkle
Media Development Supervisor:
Richard Graves
Editorial Assistant: Amanda Foxworth
Cartoons: Rich Tennant,
www.the5thwave.com
Composition
Project Coordinator: Courtney MacIntyre
Layout and Graphics: Amanda Carter,
Andrea Dahl, Lauren Goddard,
Denny Hager, Joyce Haughey,
Stephanie D. Jumper, Michael Kruzil,
Jacque Schneider

Proofreaders: Carl William Pierce,
Sossity Smith, Brian H. Walls
Indexer: Lynnzee Elze
Publishing and Editorial for Technology Dummies
Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary C. Corder, Editorial Director
Publishing for Consumer Dummies
Diane Graves Steele, Vice President and Publisher
Joyce Pepple, Acquisitions Director
Composition Services
Gerry Fahey, Vice President of Production Services
Debbie Stailey, Director of Composition Services
Contents at a Glance
Introduction 1
Book I: Fedora Basics 7
Chapter 1: Introducing Fedora Core 9
Chapter 2: Installing Fedora Core 31
Chapter 3: Troubleshooting and Configuring Fedora Core 57
Chapter 4: Trying Out Fedora Core 75
Chapter 5: Cool Fedora Core Install Projects 99
Book II: Workstations and Applications 109
Chapter 1: Exploring the GUI Desktops 111
Chapter 2: Learning the Shell 135
Chapter 3: Navigating the Linux File System 153
Chapter 4: Exploring Fedora Core Applications 169
Chapter 5: Using Text Editors 199
Book III: OpenOffice.org 211
Chapter 1: Writing with OpenOffice.org Writer 213
Chapter 2: Preparing Spreadsheets with OpenOffice.org Calc 237

Chapter 3: Making Presentations with OpenOffice.org Impress 249
Chapter 4: Drawing with OpenOffice.org Draw 261
Book IV: Networking 269
Chapter 1: Connecting to the Internet 271
Chapter 2: Setting Up a Local Area Network 295
Chapter 3: Adding a Wireless Ethernet LAN 307
Chapter 4: Managing the Network 319
Chapter 5: Cool Networking Projects 329
Book V: Internet 335
Chapter 1: Exchanging E-Mail and Instant Messages 337
Chapter 2: Using the Web 351
Chapter 3: Reading Newsgroups 371
Chapter 4: Transferring Files with FTP 383
Book VI: Administration 391
Chapter 1: Performing Basic System Administration 393
Chapter 2: Managing Users 425
Chapter 3: Managing the File System 437
Chapter 4: Managing Applications 461
Chapter 5: Managing Devices and Printers 479
Chapter 6: Upgrading and Customizing the Kernel 493
Book VII: Security 519
Chapter 1: Understanding Network and Host Security 521
Chapter 2: Securing the Host 535
Chapter 3: Securing the Network 557
Chapter 4: Performing Security Audits 577
Book VIII: Internet Servers 595
Chapter 1: Managing the Servers 597
Chapter 2: Running the Apache Web Server 615
Chapter 3: Setting Up the FTP Server 639
Chapter 4: Serving Up Mail and News 647

Chapter 5: Setting Up DNS 675
Chapter 6: Running Samba and NFS 695
Book IX: Programming 707
Chapter 1: Fedora Core Programming Essentials 709
Chapter 2: Programming in C 735
Chapter 3: Writing Shell Scripts 767
Chapter 4: Programming in Perl 779
Appendix: About the DVD 807
Index 811
Table of Contents
Introduction 1
About This Book 1
Conventions Used in This Book 2
What You Don’t Have to Read 2
Who Are You? 3
How This Book Is Organized 3
What’s on the DVD? 4
Icons Used in This Book 5
Where to Go from Here 5
Book I: Fedora Basics 7
Chapter 1: Introducing Fedora Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
What Is Fedora Core? 9
Operating systems and Linux 9
Linux distributions 11
Transitioning to the Fedora Project 11
Making sense of version numbers 12
Under the hood in Linux kernel 2.6 13
What Fedora Core Includes 16
GNU software 16
GUIs and applications 19

Networks 20
Internet servers 21
Software development 22
Online documentation 23
What Fedora Core Helps You Manage 25
Disks, CD-ROMs, and DVD-ROMs 25
Peripheral devices 26
File systems and sharing 27
Network 27
How Do I Get Started? 28
Install 28
Configure 28
Explore 29
Learn 29
Red Hat Fedora Linux 2 All-in-One Desk Reference For Dummies
x
Chapter 2: Installing Fedora Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31
Following the Installation Steps 31
Checking Your PC’s Hardware 33
Setting Aside Space for Fedora Core 34
Defragmenting your hard disk 34
Resizing your hard disk partition 36
Starting the Fedora Core Installation 39
Selecting Keyboard, Mouse, and Installation Type 40
Partitioning the Disk for Fedora Core 43
Setting Up Key System Parameters 47
Installing the boot loader 47
Configuring the network 48
Configuring the firewall and SELinux 50
Selecting languages to support 51

Setting the time zone 51
Setting the root password 52
Selecting and Installing the Package Groups 53
Chapter 3: Troubleshooting and Configuring Fedora Core . . . . . . . . .57
Using Text Mode Installation 58
Using the linux noprobe Command 58
Troubleshooting X 59
Resolving Other Installation Problems 61
The fatal signal 11 error 61
Using kernel boot commands 62
Setting Up Printers 64
Turning On Sound 68
Adding User Accounts 69
Managing DVDs and CD-ROMs 71
Installing RPM Packages 72
Chapter 4: Trying Out Fedora Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75
Booting Fedora Core 75
Exploring GUI Desktops 81
GNOME 81
KDE 88
Playing with the Shell 94
Starting the Bash shell 95
Understanding shell commands 95
Trying a few Linux commands 96
Shutting Down 98
Chapter 5: Cool Fedora Core Install Projects . . . . . . . . . . . . . . . . . . . .99
Joining the BitTorrent 99
Things you need 100
Steps to follow 100
Table of Contents

xi
Burning Fedora Core CDs 103
Things you need 103
Steps to follow 103
Preparing a Fedora Core DVD 104
Things you need 104
Steps to follow 105
Doing an FTP Install 107
Things you need 107
Steps to follow 107
Book II: Workstations and Applications 109
Chapter 1: Exploring the GUI Desktops . . . . . . . . . . . . . . . . . . . . . . . .111
Learning the Common Features of the GUIs 111
Desktop pop-up menus 112
Icon pop-up menus 113
The panel 114
The Main Menu 116
Exploring GNOME 119
Using the Nautilus shell 120
Configuring GNOME 124
Exploring KDE 127
Using Konqueror 128
Configuring KDE 132
Chapter 2: Learning the Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135
Opening Terminal Windows and Virtual Consoles 135
Using the Bash Shell 136
Learning the syntax of shell commands 136
Combining shell commands 138
Controlling command input and output 138
Typing less with automatic command completion 140

Going wild with asterisks and question marks 140
Repeating previously typed commands 142
Learning Linux Commands 142
Becoming root (superuser) 146
Managing processes 147
Working with date and time 147
Processing files 148
Writing Shell Scripts 151
Chapter 3: Navigating the Linux File System . . . . . . . . . . . . . . . . . . . .153
Understanding the Linux File System 153
Navigating the File System with Linux Commands 157
Commands for directory navigation 158
Commands for directory listings and permissions 159
Red Hat Fedora Linux 2 All-in-One Desk Reference For Dummies
xii
Commands for changing permissions and ownerships 162
Commands for working with files 163
Commands for working with directories 164
Commands for finding files 165
Commands for mounting and unmounting 166
Commands for checking disk-space usage 167
Chapter 4: Exploring Fedora Core Applications . . . . . . . . . . . . . . . . .169
Taking Stock of the Fedora Core Applications 169
Office Applications and Tools 171
Calculators 172
Commercially available office applications for Linux 173
aspell spelling checker 175
Databases 176
Adding a database user 177
Reviewing the steps to build the database 178

Designing the database 179
Creating an empty database 180
Using the PostgreSQL interactive terminal 180
Defining a table 181
Inserting records into a table 182
Querying the database 182
Multimedia Applications 183
Using a digital camera 183
Playing audio CDs 186
Playing sound files 187
Burning a CD 188
Graphics and Imaging 193
The GIMP 194
Gnome Ghostview 196
Chapter 5: Using Text Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199
Using GUI Text Editors 199
Text Editing with ed and vi 200
Using ed 201
Using vi 204
Book III: OpenOffice.org 211
Chapter 1: Writing with OpenOffice.org Writer . . . . . . . . . . . . . . . . .213
Getting Documents from Others 214
Taking Stock of OpenOffice.org Writer 215
Table of Contents
xiii
Getting Started with Writer 216
Examining the Writer main window 217
Setting up Writer 218
Preparing Documents in Writer 221
Editing and reviewing documents 221

Using styles and templates 224
Performing page layout 228
Creating and inserting graphics 231
Using fields 233
Working with large documents 235
Chapter 2: Preparing Spreadsheets with OpenOffice.org Calc . . . .237
Taking Stock of OpenOffice.org Calc 237
Getting Started with Calc 238
Examining the Calc main window 239
Setting up Calc 240
Using Calc 241
Entering and formatting data 241
Calculating and charting data 244
Chapter 3: Making Presentations with OpenOffice.org Impress . . .249
Taking Stock of OpenOffice.org Impress 249
Getting Started with Impress 250
Using Impress 253
Preparing presentations 254
Adding graphics and special effects 257
Delivering presentations 260
Chapter 4: Drawing with OpenOffice.org Draw . . . . . . . . . . . . . . . . .261
Taking Stock of OpenOffice.org Draw 261
Getting Started with Draw 262
Using Draw 264
Book IV: Networking 269
Chapter 1: Connecting to the Internet . . . . . . . . . . . . . . . . . . . . . . . . . .271
Understanding the Internet 271
Deciding How to Connect to the Internet 272
Connecting with DSL 274
How DSL works 274

DSL alphabet soup: ADSL, IDSL, SDSL 275
Typical DSL setup 276
Red Hat Fedora Linux 2 All-in-One Desk Reference For Dummies
xiv
Connecting with a Cable Modem 279
How cable modem works 280
Typical cable modem setup 282
Setting Up Dial-Up Networking 284
Connecting the modem 286
Testing the modem 289
Setting up and activating a PPP connection 291
Configuring CHAP and PAP authentication 293
Chapter 2: Setting Up a Local Area Network . . . . . . . . . . . . . . . . . . .295
Understanding TCP/IP 295
TCP/IP and the Internet 297
IP addresses 297
Internet services and port numbers 298
Setting Up an Ethernet LAN 299
How Ethernet works 300
Ethernet cables 301
Configuring TCP/IP Networking 302
Connecting Your LAN to the Internet 305
Chapter 3: Adding a Wireless Ethernet LAN . . . . . . . . . . . . . . . . . . . .307
Understanding Wireless Ethernet Networks 307
Understanding infrastructure and ad hoc modes 308
Understanding wired equivalent privacy (WEP) 310
Setting Up the Wireless Hardware 310
Configuring the wireless access point 312
Configuring Wireless Networking 312
Chapter 4: Managing the Network . . . . . . . . . . . . . . . . . . . . . . . . . . . .319

Learning the TCP/IP Configuration Files 319
/etc/hosts 320
/etc/networks 320
/etc/host.conf 320
/etc/resolv.conf 321
/etc/hosts.allow 321
/etc/hosts.deny 322
/etc/nsswitch.conf 323
Checking Out TCP/IP Networks 323
Checking the network interfaces 323
Checking the IP routing table 324
Checking connectivity to a host 325
Checking network status 325
Sniffing network packets 327
Configuring Networks at Boot Time 328
Table of Contents
xv
Chapter 5: Cool Networking Projects . . . . . . . . . . . . . . . . . . . . . . . . . .329
Building Your Own Home Network 329
Things you need 329
Steps to follow 330
Adding Wireless to Your Current Network 331
Things you need 331
Steps to follow 331
Turning Your Fedora Core System into a NAT Router 332
Things you need 332
Steps to follow 333
Book V: Internet 335
Chapter 1: Exchanging E-Mail and Instant Messages . . . . . . . . . . . .337
Understanding Electronic Mail 338

How MUA and MTA work 338
Mail message enhancements 339
Taking Stock of Mail Readers and IM Clients in Fedora Core 340
Using Ximian Evolution 340
Using Mozilla Mail 344
Managing your Inbox 347
Composing and sending messages 348
Instant Messaging with Gaim 349
Chapter 2: Using the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .351
Discovering the World Wide Web 351
Like a giant spider’s web 352
Links and URLs 353
Web servers and Web browsers 355
Web Browsing in Fedora Core 356
Checking out the Web browsers in Fedora Core 357
Starting Mozilla 357
Learning Mozilla’s user interface 357
Changing your home page 361
Changing Mozilla’s appearance 361
Surfing the Net with Mozilla 363
Creating Web Pages 364
Introducing HTML 364
Composing Web pages with Mozilla Composer 366
Red Hat Fedora Linux 2 All-in-One Desk Reference For Dummies
xvi
Chapter 3: Reading Newsgroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371
Understanding Newsgroups 371
Newsgroup hierarchy 372
Top-level newsgroup categories 373
Linux-related newsgroups 374

Reading Newsgroups from Your ISP 375
Reading newsgroups with Mozilla Mail 376
Newsgroup subscriptions 378
Posting news 379
Reading and Searching Newsgroups at Web Sites 380
Chapter 4: Transferring Files with FTP . . . . . . . . . . . . . . . . . . . . . . . . .383
Using Graphical FTP Clients 383
Using gFTP 384
Using a Web browser as an FTP client 385
Using the Command-Line FTP Client 387
Book VI: Administration 391
Chapter 1: Performing Basic System Administration . . . . . . . . . . . .393
Taking Stock of System-Administration Tasks 393
How to Become root 395
Using the su - command 395
Becoming root for the GUI Utilities 395
Recovering from a forgotten root password 396
Understanding How Fedora Core Boots 397
Understanding the init process 397
Examining the /etc/inittab file 399
Trying a new run level with the init command 400
Understanding the Fedora Core startup scripts 401
Manually starting and stopping servers 402
Automatically starting servers at system startup 403
Understanding the GUI startup 404
Taking Stock of Fedora Core System Configuration Files 406
Monitoring System Performance 408
Using the top utility 409
Using the GNOME system monitor 411
Using the uptime command 412

Using the vmstat utility 413
Checking disk performance and disk usage 414
Viewing System Information via the /proc File System 415
Scheduling Jobs in Fedora Core 418
Scheduling one-time jobs 419
Scheduling recurring jobs 421
Table of Contents
xvii
Chapter 2: Managing Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .425
Adding User Accounts 425
Using the User Manager to add user accounts 426
Using commands to manage user accounts 428
Understanding the /etc/passwd File 429
Managing Groups 430
Exploring the User Environment 431
Changing User and Group Ownership of Files 434
Chapter 3: Managing the File System . . . . . . . . . . . . . . . . . . . . . . . . . .437
Learning the Linux File System 437
Understanding the file-system hierarchy 438
Mounting a device on the file system 440
Examining the /etc/fstab file 442
Sharing Files with NFS 443
Exporting a file system with NFS 444
Mounting an NFS file system 445
Backing Up and Restoring Files 445
Selecting a backup strategy and media 445
Commercial backup utilities for Linux 447
Using the tape archiver — tar 447
Accessing DOS/Windows File Systems 452
Mounting a DOS disk partition 452

Mounting DOS floppy disks 453
Mounting an NTFS Partition 455
Using mtools 455
Trying mtools 456
Understanding the /etc/mtools.conf file 456
Learning the mtools commands 457
Formatting a DOS floppy 459
Chapter 4: Managing Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
Working with Red Hat Package Manager 461
Using the RPM commands 461
Understanding RPM filenames 462
Finding out about RPMs 463
Installing an RPM 466
Removing an RPM 467
Upgrading an RPM 467
Verifying an RPM 468
Building Software Packages from Source Files 469
Downloading and unpacking the software 469
Building the software from source files 471
Installing SRPMS 474
Updating Fedora Core Applications with Up2date 474
Using Yellow dog Updater, Modified (Yum) 475
Red Hat Fedora Linux 2 All-in-One Desk Reference For Dummies
xviii
Chapter 5: Managing Devices and Printers . . . . . . . . . . . . . . . . . . . . .479
Understanding Linux Devices 479
Device files 480
Persistent device naming with udev 482
Managing Loadable Driver Modules 482
Loading and unloading modules 483

Using the /etc/modprobe.conf file 485
Managing USB Devices 486
Managing Print Queues in Fedora Core 488
Spooling and print jobs 488
Printing with the lp command 490
Checking the print queue using lpq 490
Canceling the print job using cancel 490
Checking the printer status using lpstat 491
Controlling the print queue 491
Chapter 6: Upgrading and Customizing the Kernel . . . . . . . . . . . . . . .493
Upgrading with a Kernel RPM 494
Downloading new kernel RPMs 494
Installing the kernel RPMs 494
Trying out the new kernel 495
Rebuilding the Kernel 496
Creating a monolithic versus a modular kernel 497
Configuring the kernel 498
Running the kernel configuration tool 499
Building the Kernel and the Modules 513
Installing the Modules 514
Creating the Initial RAM Disk File 514
Installing the New Kernel and Setting Up GRUB 515
Rebooting the System 517
Book VII: Security 519
Chapter 1: Understanding Network and Host Security . . . . . . . . . . .521
Why Worry About Security? 521
Establishing a Security Framework 522
Determine business requirements for security 523
Perform risk analysis 524
Establish security policy 525

Implement security solutions (mitigation) 526
Manage security 526
Table of Contents
xix
Securing Linux 527
Understanding the host security issues 527
Understanding network security issues 528
Learning Computer Security Terminology 529
Keeping Up with Security News and Updates 532
Chapter 2: Securing the Host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .535
Installing Operating System Updates 535
Securing Passwords 536
Shadow passwords 536
Pluggable authentication modules (PAMs) 537
Protecting Files and Directories 540
Viewing ownerships and permissions 540
Changing file ownerships 541
Changing file permissions 541
Setting default permission 542
Checking for set user ID permission 543
Using exec-shield 544
Using SELinux 545
Encrypting and Signing Files with GnuPG 547
Understanding public-key encryption 547
Understanding digital signatures 548
Using GPG 550
Monitoring System Security 554
Chapter 3: Securing the Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . .557
Securing Internet Services 557
Using chkconfig to disable standalone services 558

Configuring the xinetd server to disable services 558
Using Secure Shell (SSH) for Remote Logins 561
Setting Up Simple Firewalls 563
Screening the router with packet filtering 565
Dual-homed host 567
Perimeter network with bastion host 568
Application gateway 570
Enabling Packet Filtering on Your Fedora Core System 571
Using the security level configuration tool 572
Using the iptables command 573
Chapter 4: Performing Security Audits . . . . . . . . . . . . . . . . . . . . . . . . .577
Understanding Security Audits 577
Nontechnical aspects of security audits 578
Technical aspects of security audits 579
Red Hat Fedora Linux 2 All-in-One Desk Reference For Dummies
xx
Learning a Security Test Methodology 579
Some common computer vulnerabilities 580
Host security review 582
Network-security review 585
Exploring Security Testing Tools 588
Nmap 589
Nessus 590
SAINT 593
SARA 594
Book VIII: Internet Servers 595
Chapter 1: Managing the Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .597
Understanding Internet Services 597
TCP/IP and sockets 598
Internet services and port numbers 601

Using the xinetd Super Server 603
Running Standalone Servers 606
Starting and stopping servers manually 606
Starting servers automatically at boot time 607
Chapter 2: Running the Apache Web Server . . . . . . . . . . . . . . . . . . . .615
Exploring HTTP 615
Exploring the Apache Web Server 618
Installing the Apache Web server 619
Starting the Apache Web server 620
Configuring the Apache Web Server 621
Using Apache configuration tools 622
Apache configuration files 623
The httpd.conf configuration file 624
Virtual host setup 634
Chapter 3: Setting Up the FTP Server . . . . . . . . . . . . . . . . . . . . . . . . . .639
Installing the FTP Server 639
Configuring the FTP Server 640
vsftpd configuration files 640
/etc/vsftpd/vsftpd.conf file 641
/etc/vsftpd.ftpusers file 643
/etc/vsftpd.user_list file 644
Setting Up Secure Anonymous FTP 644
Trying Anonymous FTP 645
Key features of anonymous FTP 645
Table of Contents
xxi
Chapter 4: Serving Up Mail and News . . . . . . . . . . . . . . . . . . . . . . . . .647
Installing the Mail Server 647
Using sendmail 648
A mail-delivery test 649

The mail-delivery mechanism 649
The sendmail configuration file 651
sendmail.cf file syntax 659
Other sendmail files 661
The .forward file 662
Invoking procmail in the .forward file 663
The sendmail alias file 664
Installing the News Server 665
Configuring and Starting the INN Server 665
InterNetNews components 666
The incoming.conf file 670
The readers.conf file 671
InterNetNews startup 671
Setting Up Local Newsgroups 672
Defining a newsgroup hierarchy 673
Updating configuration files 673
Adding the newsgroups 674
Testing your newsgroups 674
Chapter 5: Setting Up DNS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .675
Understanding Domain Name System (DNS) 675
What is DNS? 676
Learning hierarchical domain names 677
Exploring Berkeley Internet Name Domain (BIND) 678
Configuring DNS 682
Configuring the resolver 682
Configuring a caching name server 683
Configuring a primary name server 692
Chapter 6: Running Samba and NFS . . . . . . . . . . . . . . . . . . . . . . . . . . .695
Sharing Files with NFS 695
Exporting a file system with NFS 696

Mounting an NFS file system 698
Using the NFS Server Configuration tool 699
Setting Up a Windows Server Using Samba 700
Checking whether Samba is installed 702
Configuring Samba 703
Trying out Samba 705
Red Hat Fedora Linux 2 All-in-One Desk Reference For Dummies
xxii
Book IX: Programming 707
Chapter 1: Fedora Core Programming Essentials . . . . . . . . . . . . . . . .709
Learning Programming 709
A simplified view of a computer 710
Role of the operating system 711
Basics of computer programming 712
Exploring the Software Development Tools in Fedora Core 713
GNU C and C++ compilers 714
The GNU make utility 718
The GNU debugger 725
Understanding the Implications of GNU Licenses 732
The GNU General Public License 732
The GNU Library General Public License 733
Chapter 2: Programming in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .735
The Structure of a C Program 735
Preprocessor Directives 737
Including files 738
Defining macros 738
Declaration and Definition of Variables 741
Basic data types 741
Enumerations 742
Structures, Unions, and Bit Fields 743

Arrays 743
Pointers 744
Type definitions 745
Type qualifiers: const and volatile 746
Expressions 747
Operator Precedence 749
Statements 751
The break statement 751
The case statement 752
A compound statement or block 752
The continue statement 752
The default label 753
The do statement 753
Expression statements 753
The for statement 753
The goto statement 754
The if statement 754
The if-else statement 754
The null statement 755
The return statement 755

×