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

linux all-in-one desk reference for dummies 2005

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 (19 MB, 813 trang )

Linux
®
All-in-One DESK REFERENCE
FOR
DUMmIES

TEAM LinG - Live, Informative, Non-cost and Genuine !
TEAM LinG - Live, Informative, Non-cost and Genuine !
by Naba Barkakati
Linux
®
All-in-One DESK REFERENCE
FOR
DUMmIES

TEAM LinG - Live, Informative, Non-cost and Genuine !
Linux
®
All-in-One Desk Reference For Dummies
®
Published by
Wiley Publishing, Inc.
111 River Street
Hoboken, NJ 07030-5774
Copyright © 2005 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 per-


mission 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: brandreview@
wiley.com.
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. Linux is a registered trade-
mark 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 MATERIALS.
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 COMPE-
TENT 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. FULFILLMENT OF EACH COUPON OFFER IS THE SOLE RESPONSIBILITY OF THE OFFEROR.
For general information on our other products and services, please contact 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.
For technical support, please visit www.wiley.com/techsupport.
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: 2004116155
ISBN: 0-7645-7936-3
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
1O/QU/QR/QV/IN
TEAM LinG - Live, Informative, Non-cost and Genuine !
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. Government Accountability Office (GAO).
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 best-selling 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 Fedora Linux 2 All-in-One Desk Reference For Dummies, also published
by Wiley Publishing, Inc.
Naba lives in North Potomac, Maryland, with his wife Leha, and their children,
Ivy, Emily, and Ashley.
TEAM LinG - Live, Informative, Non-cost and Genuine !
TEAM LinG - Live, Informative, Non-cost and Genuine !

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 eight quick reference guides about Linux that focuses on several major
Linux distributions. As the project editor, Paul Levesque guided me through
the manuscript-submission process and kept everything moving. I appreciate
the guidance and support that Terri and Paul 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. 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!
TEAM LinG - Live, Informative, Non-cost and Genuine !
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: Paul Levesque
Acquisitions Editor: Terri Varveris
Copy Editor: Jean Rogers

Technical Editor: Jason Luster
Editorial Manager: Kevin Kirschner
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)
Production
Project Coordinator: Nancee Reeves
Layout and Graphics: Andrea Dahl,
Denny Hager, Joyce Haughey,
Stephanie D. Jumper, Heather Ryan,
Jacque Roth
Proofreaders: Laura Albert, John Greenough,
Jessica Kramer, Arielle Mennelle,
Carl Pierce, Dwight Ramsey
Indexer: Sherry Massey
Special Help: Teresa Artman, Virginia Sanders
Publishing and Editorial for Technology Dummies
Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary Bednarek, Executive Acquisitions Director
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
TEAM LinG - Live, Informative, Non-cost and Genuine !
Contents at a Glance
Introduction 1
Book I: Linux Basics 7
Chapter 1: Introducing Linux 9
Chapter 2: Installing Linux 29
Chapter 3: Troubleshooting and Configuring Linux 71
Chapter 4: Trying Out Linux 101
Book II: Linux Desktops 121
Chapter 1: Introducing the GUI Desktops 123
Chapter 2: Commanding the Shell 145
Chapter 3: Navigating the Linux File System 165
Chapter 4: Introducing Linux Applications 191
Chapter 5: Using Text Editors 221
Book III: Networking 231
Chapter 1: Connecting to the Internet 233
Chapter 2: Setting Up a Local Area Network 255
Chapter 3: Adding a Wireless Ethernet LAN 267
Chapter 4: Managing the Network 277
Book IV: Internet 289
Chapter 1: E-Mailing and IMing in Linux 291
Chapter 2: Browsing the Web 309
Chapter 3: Reading Newsgroups 323
Chapter 4: Using FTP 337
Book V: Administration 347
Chapter 1: Learning Basic System Administration 349
Chapter 2: Managing Users and Groups 387

Chapter 3: Managing File Systems 397
Chapter 4: Installing and Updating Applications 421
Chapter 5: Customizing the Linux Kernel 445
TEAM LinG - Live, Informative, Non-cost and Genuine !
Book VI: Security 469
Chapter 1: Introducing Linux Security 471
Chapter 2: Securing a Linux Host 485
Chapter 3: Improving Network Security 501
Chapter 4: Performing Computer Security Audits 517
Book VII: Internet Servers 533
Chapter 1: Managing Internet Services 535
Chapter 2: Running a Web Server 551
Chapter 3: Setting Up the FTP Server 573
Chapter 4: Managing Mail and News Servers 579
Chapter 5: Managing DNS 603
Chapter 6: Using Samba and NFS 623
Book VIII: Programming 631
Chapter 1: Programming in Linux 633
Chapter 2: Programming in C 659
Chapter 3: Writing Shell Scripts 691
Chapter 4: Programming in Perl 703
Appendix: About the DVD 731
Index 737
TEAM LinG - Live, Informative, Non-cost and Genuine !
Table of Contents
Introduction 1
About This Book 2
Conventions Used in This Book 3
What You Don’t Have to Read 3
Who Are You? 3

How This Book Is Organized 4
What’s on the DVD? 5
Icons Used in This Book 5
Where to Go from Here 6
Book I: Linux Basics 7
Chapter 1: Introducing Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
What Is Linux? 9
Linux distributions 10
Making sense of version numbers 13
Linux Standard Base (LSB) 14
What a Linux Distribution Includes 15
GNU software 15
GUIs and applications 19
Networks 20
Internet servers 20
Software development 21
Online documentation 22
What Linux Helps You Manage 23
Disks, CD-ROMs, and DVD-ROMs 24
Peripheral devices 25
File systems and sharing 25
Network 26
Getting Started 26
Install 26
Configure 27
Explore 27
Learn 28
Chapter 2: Installing Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
Following the Installation Steps 30
Burning CDs from ISO Images 32

TEAM LinG - Live, Informative, Non-cost and Genuine !
Linux All-in-One Desk Reference For Dummies
xii
Checking Your PC’s Hardware 32
Setting Aside Space for Linux 34
Trying Out Knoppix Live CD 35
Installing Debian GNU/Linux 36
Getting an overview of the installation 36
Completing the Debian installation 37
Installing Fedora Core 41
Selecting keyboard and installation type 42
Partitioning the hard drive for Fedora Core 43
Setting up key system parameters 44
Selecting and installing the package groups 48
Installing SUSE Linux 50
Performing an FTP install 51
Installing SUSE Linux from CDs or DVD 54
Installing Xandros Desktop 62
Using Xandros Express Install 64
Using Xandros Custom Install 66
Chapter 3: Troubleshooting and Configuring Linux . . . . . . . . . . . . . . .71
Using Text Mode Installation 71
Disabling Hardware Probing in Fedora 72
Troubleshooting X 73
Resolving Other Installation Problems 75
Using Knoppix boot commands 75
The fatal signal 11 error 77
Using Linux kernel boot options 78
Setting Up Printers 81
Configuring printers in Debian 81

Configuring printers in Fedora Core 83
Configuring printers in Knoppix 86
Configuring printers in SUSE 88
Configuring printers in Xandros 90
Managing DVDs and CD-ROMs 92
Installing Other Software 93
Installing software in Debian 93
Installing software in Fedora Core 95
Installing software in SUSE 96
Installing software in Xandros 97
Chapter 4: Trying Out Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101
Starting Linux 101
Exploring GUI Desktops 104
GNOME 105
KDE 111
TEAM LinG - Live, Informative, Non-cost and Genuine !
Table of Contents
xiii
Playing with the Shell 115
Starting the Bash shell 116
Understanding shell commands 117
Trying a few Linux commands 117
Shutting Down 119
Book II: Linux Desktops 121
Chapter 1: Introducing the GUI Desktops . . . . . . . . . . . . . . . . . . . . . . .123
Getting to Know the Common Features of the GUIs 124
Desktop context menus 125
Icon context menus 126
The panel 127
The Main Menu 129

Introducing Debian’s KDE Desktop 131
Introducing Fedora Core’s GNOME Desktop 134
Introducing the Knoppix Desktop 136
Introducing the SUSE Desktop 140
Introducing the Xandros Desktop 142
Chapter 2: Commanding the Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145
Opening Terminal Windows and Virtual Consoles 145
Using the Bash Shell 146
Understanding the syntax of shell commands 146
Combining shell commands 148
Controlling command input and output 148
Typing less with automatic command completion 150
Going wild with asterisks and question marks 150
Repeating previously typed commands 152
Discovering and Using Linux Commands 153
Becoming root (superuser) 156
Managing processes 157
Working with date and time 158
Processing files 159
Writing Shell Scripts 162
Chapter 3: Navigating the Linux File System . . . . . . . . . . . . . . . . . . . .165
Understanding the Linux File System 165
Using GUI File Managers 170
Using the Nautilus shell 170
Using Konqueror 175
TEAM LinG - Live, Informative, Non-cost and Genuine !
Linux All-in-One Desk Reference For Dummies
xiv
Navigating the File System with Linux Commands 179
Commands for directory navigation 179

Commands for directory listings and permissions 180
Commands for changing permissions and ownerships 183
Commands for working with files 184
Commands for working with directories 186
Commands for finding files 186
Commands for mounting and unmounting 188
Commands for checking disk-space usage 189
Chapter 4: Introducing Linux Applications . . . . . . . . . . . . . . . . . . . . .191
Taking Stock of Linux Applications 191
Office Applications and Tools 197
OpenOffice.org Office Suite 198
Calendars 201
Calculators 202
Commercially available office applications for Linux 203
aspell spelling checker 205
Databases 206
Reviewing the steps to build the database 207
Designing the database 208
Creating an empty database 208
Using the MySQL monitor 208
Defining a table 209
Loading data into a table 210
Querying the database 211
Multimedia Applications 211
Using a digital camera 212
Playing audio CDs 213
Playing sound files 214
Burning a CD 216
Graphics and Imaging 217
The GIMP 217

Gnome Ghostview 219
Chapter 5: Using Text Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221
Using GUI Text Editors 221
Text Editing with ed and vi 222
Using ed 223
Using vi 226
TEAM LinG - Live, Informative, Non-cost and Genuine !
Table of Contents
xv
Book III: Networking 231
Chapter 1: Connecting to the Internet . . . . . . . . . . . . . . . . . . . . . . . . . .233
Understanding the Internet 233
Deciding How to Connect to the Internet 234
Connecting with DSL 236
How DSL works 236
DSL alphabet soup: ADSL, IDSL, SDSL 237
Typical DSL setup 238
Connecting with a Cable Modem 242
How cable modem works 242
Typical cable modem setup 244
Setting Up Dialup Networking 247
Connecting the modem 248
Setting up and activating a PPP connection 250
Configuring CHAP and PAP authentication 252
Chapter 2: Setting Up a Local Area Network . . . . . . . . . . . . . . . . . . .255
Understanding TCP/IP 255
TCP/IP and the Internet 257
IP addresses 258
Internet services and port numbers 258
Setting Up an Ethernet LAN 259

How Ethernet works 260
Ethernet cables 261
Configuring TCP/IP Networking 262
Connecting Your LAN to the Internet 264
Chapter 3: Adding a Wireless Ethernet LAN . . . . . . . . . . . . . . . . . . . .267
Understanding Wireless Ethernet Networks 267
Understanding infrastructure and ad hoc modes 268
Understanding Wired Equivalent Privacy (WEP) 269
Setting Up the Wireless Hardware 269
Configuring the wireless access point 272
Configuring Wireless Networking 272
Chapter 4: Managing the Network . . . . . . . . . . . . . . . . . . . . . . . . . . . .277
Discovering the TCP/IP Configuration Files 277
/etc/hosts 278
/etc/networks 278
/etc/host.conf 278
TEAM LinG - Live, Informative, Non-cost and Genuine !
Linux All-in-One Desk Reference For Dummies
xvi
/etc/resolv.conf 279
/etc/hosts.allow 279
/etc/hosts.deny 280
/etc/nsswitch.conf 280
Checking Out TCP/IP Networks 281
Checking the network interfaces 281
Checking the IP routing table 282
Checking connectivity to a host 282
Checking network status 283
Sniffing network packets 285
Configuring Networks at Boot Time 286

Book IV: Internet 289
Chapter 1: E-Mailing and IMing in Linux . . . . . . . . . . . . . . . . . . . . . . .291
Understanding Electronic Mail 292
How MUA and MTA work 292
Mail message enhancements 294
Taking Stock of Mail Readers and IM Clients in Linux 294
E-Mailing in Linux 295
Introducing Ximian Evolution 295
Introducing Mozilla Mail 299
Introducing KMail 303
Instant Messaging in Linux 305
Using Gaim 305
Using Kopete 307
Chapter 2: Browsing the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309
Discovering the World Wide Web 309
Like a giant spider’s web 310
Links and URLs 310
Web servers and Web browsers 313
Web Browsing in Linux 314
Checking out Web browsers for Linux 315
Learning Mozilla’s user interface 315
Changing your home page 318
Surfing the Net with Mozilla 319
Introducing Epiphany and Firefox 320
Chapter 3: Reading Newsgroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .323
Understanding Newsgroups 323
Newsgroup hierarchy 324
Top-level newsgroup categories 325
Linux-related newsgroups 326
TEAM LinG - Live, Informative, Non-cost and Genuine !

Table of Contents
xvii
Reading Newsgroups from Your ISP 327
Taking stock of newsreaders 328
Reading newsgroups with Mozilla Mail 328
Newsgroup subscriptions 331
Posting news 331
Using KNode 332
Using Pan 333
Reading and Searching Newsgroups at Web Sites 335
Chapter 4: Using FTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337
Using Graphical FTP Clients 337
Using gFTP 338
Introducing KBear 340
Using a Web browser as an FTP client 340
Using the Command-Line FTP Client 342
Book V: Administration 347
Chapter 1: Learning Basic System Administration . . . . . . . . . . . . . . .349
Taking Stock of System Administration Tasks 349
Introducing Some GUI Sysadmin Tools 351
GUI sysadmin tools in Debian 351
GUI sysadmin tools in Fedora Core 351
GUI sysadmin tools in Knoppix 352
GUI sysadmin tools in SUSE 353
GUI sysadmin tools in Xandros 354
How to Become root 355
Using the su - command 356
Becoming root for the GUI utilities 356
Recovering from a forgotten root password 357
Understanding How Linux Boots 358

Understanding the init process 358
Examining the /etc/inittab file 360
Trying a new run level with the init command 361
Understanding the Linux startup scripts 362
Manually starting and stopping servers 363
Automatically starting servers at system startup 363
Taking Stock of Linux System Configuration Files 364
Monitoring System Performance 367
Using the top utility 367
Using the uptime command 369
Using the vmstat utility 370
Checking disk performance and disk usage 371
Viewing System Information via the /proc File System 372
TEAM LinG - Live, Informative, Non-cost and Genuine !
Linux All-in-One Desk Reference For Dummies
xviii
Understanding Linux Devices 375
Device files 375
Persistent device naming with udev 377
Managing Loadable Driver Modules 378
Loading and unloading modules 378
Using the /etc/modprobe.conf file 380
Scheduling Jobs in Linux 381
Scheduling one-time jobs 381
Scheduling recurring jobs 383
Chapter 2: Managing Users and Groups . . . . . . . . . . . . . . . . . . . . . . . .387
Adding User Accounts 387
Using a GUI User Manager to add user accounts 388
Using commands to manage user accounts 390
Understanding the /etc/passwd File 391

Managing Groups 392
Exploring the User Environment 393
Changing User and Group Ownership of Files 396
Chapter 3: Managing File Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . .397
Exploring the Linux File System 397
Understanding the file-system hierarchy 398
Mounting a device on the file system 400
Examining the /etc/fstab file 402
Sharing Files with NFS 404
Exporting a file system with NFS 404
Mounting an NFS file system 405
Backing Up and Restoring Files 406
Selecting a backup strategy and media 406
Commercial backup utilities for Linux 407
Using the tape archiver — tar 408
Accessing a DOS/Windows File System 413
Mounting a DOS/Windows disk partition 413
Mounting DOS floppy disks 414
Mounting an NTFS partition 415
Using mtools 416
Trying mtools 417
Understanding the /etc/mtools.conf file 417
Learning the mtools commands 418
Chapter 4: Installing and Updating Applications . . . . . . . . . . . . . . . .421
Working with RPM Files 421
Using the RPM commands 422
Understanding RPM filenames 423
Querying RPMs 423
TEAM LinG - Live, Informative, Non-cost and Genuine !
Table of Contents

xix
Installing an RPM 425
Removing an RPM 426
Upgrading an RPM 427
Verifying an RPM 427
Working with DEB Files 428
Understanding DEB filenames 429
Using the dpkg command 429
Introducing dselect 431
Using APT to manage DEB packages 432
Building Software Packages from Source Files 433
Downloading and unpacking the software 433
Building the software from source files 434
Installing SRPMS 436
Updating Linux Applications Online 437
Keeping Debian updated with APT 437
Updating Fedora Core Applications 438
Updating SUSE online 441
Using Xandros Networks 442
Chapter 5: Customizing the Linux Kernel . . . . . . . . . . . . . . . . . . . . . . .445
Rebuilding the Kernel 445
Creating a monolithic versus a modular kernel 447
Configuring the kernel 447
Building the Kernel and the Modules 463
Installing the Modules 463
Creating the Initial RAM Disk File 464
Installing the New Kernel and Setting Up GRUB 464
Rebooting the System 466
Book VI: Security 469
Chapter 1: Introducing Linux Security . . . . . . . . . . . . . . . . . . . . . . . . .471

Why Worry about Security? 471
Establishing a Security Framework 472
Determining business requirements for security 473
Performing risk analysis 474
Establishing a security policy 476
Implementing security solutions (mitigation) 476
Managing security 477
Securing Linux 477
Understanding the host security issues 478
Understanding network security issues 479
Delving Into Computer Security Terminology 480
Keeping Up with Security News and Updates 484
TEAM LinG - Live, Informative, Non-cost and Genuine !
Linux All-in-One Desk Reference For Dummies
xx
Chapter 2: Securing a Linux Host . . . . . . . . . . . . . . . . . . . . . . . . . . . . .485
Securing Passwords 485
Shadow passwords 486
Pluggable authentication modules (PAMs) 487
Protecting Files and Directories 488
Viewing ownerships and permissions 488
Changing file ownerships 488
Changing file permissions 489
Setting default permission 489
Checking for set user ID permission 491
Encrypting and Signing Files with GnuPG 492
Understanding public-key encryption 492
Understanding digital signatures 493
Using GPG 494
Monitoring System Security 499

Chapter 3: Improving Network Security . . . . . . . . . . . . . . . . . . . . . . . .501
Securing Internet Services 501
Turning off standalone services 502
Configuring the Internet super server 502
Configuring TCP wrapper security 503
Using Secure Shell (SSH) for Remote Logins 504
Setting Up Simple Firewalls 506
Using NATs 510
Enabling packet filtering on your Linux system 510
Chapter 4: Performing Computer Security Audits . . . . . . . . . . . . . . . .517
Understanding Security Audits 517
Non-technical aspects of security audits 518
Technical aspects of security audits 519
Implementing a Security Test Methodology 519
Some common computer vulnerabilities 520
Host-security review 522
Network-security review 525
Exploring Security Testing Tools 528
nmap 528
Nessus 529
Book VII: Internet Servers 533
Chapter 1: Managing Internet Services . . . . . . . . . . . . . . . . . . . . . . . .535
Understanding Internet Services 535
TCP/IP and sockets 536
Internet services and port numbers 539
TEAM LinG - Live, Informative, Non-cost and Genuine !
Table of Contents
xxi
Using the Internet Super Server 541
Using inetd 541

Using xinetd 542
Running Standalone Servers 544
Starting and stopping servers manually 545
Starting servers automatically at boot time 545
Chapter 2: Running a Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . .551
Understanding HTTP 551
Exploring the Apache Web Server 554
Installing the Apache Web server 555
Starting the Apache Web server 555
Configuring the Apache Web Server 557
Using Apache configuration tools 557
Syntax of the Apache configuration files 560
The Apache Web server configuration file 560
Virtual host setup 570
Chapter 3: Setting Up the FTP Server . . . . . . . . . . . . . . . . . . . . . . . . . .573
Installing the FTP Server 573
Configuring the FTP Server 574
vsftpd configuration files 574
The vsftpd.conf file 575
/etc/vsftpd.ftpusers file 577
/etc/vsftpd.user_list file 578
Chapter 4: Managing Mail and News Servers . . . . . . . . . . . . . . . . . .579
Installing the Mail Server 579
Using sendmail 580
A mail-delivery test 580
The mail-delivery mechanism 581
The sendmail configuration file 583
sendmail.cf file syntax 589
Other sendmail files 590
The .forward file 592

The sendmail alias file 593
Installing the INN Server 593
Configuring and Starting the INN Server 594
InterNetNews components 595
The incoming.conf file 599
The readers.conf file 599
InterNetNews startup 600
Setting Up Local Newsgroups 600
Defining a newsgroup hierarchy 601
Updating configuration files 601
TEAM LinG - Live, Informative, Non-cost and Genuine !
Linux All-in-One Desk Reference For Dummies
xxii
Adding the newsgroups 602
Testing your newsgroups 602
Chapter 5: Managing DNS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .603
Understanding Domain Name System (DNS) 603
What is DNS? 603
Discovering hierarchical domain names 605
Exploring Berkeley Internet Name Domain (BIND) 606
Configuring DNS 609
Configuring the resolver 609
Configuring a caching name server 611
Configuring a primary name server 620
Chapter 6: Using Samba and NFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . .623
Sharing Files with NFS 623
Exporting a file system with NFS 624
Mounting an NFS file system 626
Setting Up a Windows Server Using Samba 627
Installing Samba 628

Configuring Samba 628
Trying out Samba 630
Book VIII: Programming 631
Chapter 1: Programming in Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . .633
An Overview of Programming 633
A simplified view of a computer 633
Role of the operating system 635
Basics of computer programming 636
Exploring the Software Development Tools in Linux 637
GNU C and C++ compilers 638
The GNU make utility 642
The GNU debugger 649
Understanding the Implications of GNU Licenses 656
The GNU General Public License 656
The GNU Library General Public License 657
Chapter 2: Programming in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .659
The Structure of a C Program 659
Preprocessor Directives 661
Including files 662
Defining macros 662
TEAM LinG - Live, Informative, Non-cost and Genuine !
Table of Contents
xxiii
Declaration and Definition of Variables 665
Basic data types 665
Enumerations 666
Structures, Unions, and Bit Fields 667
Arrays 667
Pointers 668
Type definitions 669

Type qualifiers: const and volatile 670
Expressions 671
Operator Precedence 673
Statements 675
The break statement 675
The case statement 676
A compound statement or block 676
The continue statement 676
The default label 677
The do statement 677
Expression statements 677
The for statement 677
The goto statement 678
The if statement 678
The if-else statement 678
The null statement 679
The return statement 679
The switch statement 679
The while statement 680
Functions 681
Function prototypes 681
The void type 682
Functions with a variable number of arguments 682
The C Library 682
Shared Libraries in Linux Applications 684
Examining the shared libraries that a program uses 684
Creating a shared library 685
Dynamically loading a shared library 687
Chapter 3: Writing Shell Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .691
Trying Out Simple Shell Scripts 691

Exploring the Basics of Shell Scripting 694
Storing stuff 694
Calling shell functions 695
Controlling the flow 696
Exploring Bash’s built-in commands 699
TEAM LinG - Live, Informative, Non-cost and Genuine !
Linux All-in-One Desk Reference For Dummies
xxiv
Chapter 4: Programming in Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .703
Understanding Perl 703
Determining Whether You Have Perl 704
Writing Your First Perl Script 705
Getting an Overview of Perl 706
Basic Perl syntax 707
Variables 707
Operators and expressions 711
Regular expressions 712
Flow-control statements 715
Accessing Linux commands 718
File access 720
Filename with pipe prefix 721
Subroutines 722
Built-in functions in Perl 723
Understanding Perl Packages and Modules 723
Perl packages 724
Perl modules 725
Using a module 725
Using Objects in Perl 726
Understanding Perl Objects 727
Creating and accessing Perl objects 727

Using the English module 728
Appendix: About the DVD 731
System Requirements 731
DVD Installation Instructions 732
What You’ll Find on the DVD 732
Troubleshooting 735
Index 737
TEAM LinG - Live, Informative, Non-cost and Genuine !

×