Linux Timesaving Techniques For Dummies

  • Published on
    08-Dec-2016

  • View
    255

  • Download
    25

Embed Size (px)

Transcript

  • LinuxTimesavingTechniques

    FOR

    DUMmIES

    by Susan Douglas and Korry Douglas

    01a_571737ffirs.qxd 7/2/04 7:55 PM Page i

  • 01a_571737ffirs.qxd 7/2/04 7:55 PM Page i

  • LinuxTimesavingTechniques

    FOR

    DUMmIES

    by Susan Douglas and Korry Douglas

    01a_571737ffirs.qxd 7/2/04 7:55 PM Page i

  • Linux Timesaving Techniques For Dummies

    Published byWiley Publishing, Inc.111 River StreetHoboken, 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 anymeans, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted underSections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of thePublisher, 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 per-mission 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 ofUs!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, and related trade dress are trade-marks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and othercountries, and may not be used without written permission. All other trademarks are the property of theirrespective 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 REPRESENTA-TIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THISWORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FIT-NESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMO-TIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERYSITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN REN-DERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE ISREQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUB-LISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANI-ZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OFFURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMA-TION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READ-ERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED ORDISAPPEARED 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 contact ourCustomer 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 beavailable in electronic books.

    Library of Congress Control Number: 2004101962

    ISBN: 0-7645-7173-7

    Manufactured in the United States of America

    10 9 8 7 6 5 4 3 2 1

    1V/SR/QX/QU/IN

    01a_571737ffirs.qxd 7/2/04 7:55 PM Page ii

  • About the AuthorsSusan Douglas is the CEO of Conjectrix, Inc., a software consulting firm specializing indatabase- and security-related issues. When shes not busy at the computer, Susan isprobably throwing pottery, glassblowing, or horseback riding.

    Korry Douglas is the Director of Research and Development for Appx Software. Whenhes not working on computers, hes making elegant sawdust in the woodshop.

    Together, they are the coauthors of Red Hat Linux Fedora Desktop For Dummies andPostgreSQL.

    Susan and Korry enjoy life on a farm in rural Virginia where they raise horses and smalllivestock. They both telecommute, so they have more time to spend with their 200 or soanimal friends. If theyre not at home, theyre out riding roller coasters.

    Authors AcknowledgmentsWe would like to thank all the staff at Wiley who have supported this project, from startto finish. Without the help and direction of Terri Varveris, organizing this book wouldhave been an impossible task. Becky Huehlss editorial help and guidance have kept thisproject rolling along on schedule (fairly painlessly, we might add). We also want toextend a big thanks to the technical editors whove kept us honest throughout thecourse of the book.

    Thanks go also to all the supporting staff at Wiley that weve never met. We know youreout there, and we appreciate your efforts and support.

    Thank you also to all the programmers and developers that make open-source softwaresuch an interesting, productive, and fun environment to work in.

    01a_571737ffirs.qxd 7/2/04 7:55 PM Page iii

  • CompositionProject Coordinator: Barbara Moore

    Layout and Graphics: Lauren Goddard, Denny Hager,Stephanie D. Jumper, Michael Kruzil, Lynsey Osborn,Jacque Schneider

    Proofreaders: Laura Albert, Vicki Broyles,Brian H. Walls

    Indexer: Steve Rath

    Acquisitions, Editorial, and Media DevelopmentAssociate Project Editor: Rebecca Huehls

    Acquisitions Editor: Terri Varveris

    Senior Copy Editor: Kim Darosett

    Technical Editors: Terry Collings, Corey Hynes

    Editorial Manager: Leah Cameron

    Media Development Manager: Laura VanWinkle

    Media Development Supervisor: Richard Graves

    Editorial Assistant: Amanda Foxworth

    Cartoons: Rich Tennant (www.the5thwave.com)

    Publishers AcknowledgmentsWere proud of this book; please send us your comments through our online regis-tration form located at www.dummies.com/register/.

    Some of the people who helped bring this book to market include the following:

    Publishing and Editorial for Technology DummiesRichard Swadley, Vice President and Executive Group Publisher

    Andy Cummings, Vice President and Publisher

    Mary Bednarek, Executive Editorial Director

    Mary C. Corder, Editorial Director

    Publishing for Consumer DummiesDiane Graves Steele, Vice President and Publisher

    Joyce Pepple, Acquisitions Director

    Composition ServicesGerry Fahey, Vice President of Production Services

    01a_571737ffirs.qxd 7/2/04 7:55 PM Page iv

  • Contents at a GlanceIntroduction 1

    Part I: Making the Desktop Work for You 5Technique 1: Finding the Power in

    KDE Protocols 7

    Technique 2: Getting GNOME Virtual FileSystems to Do the Work for You 13

    Technique 3: Streamlining Your Work withFile Associations 18

    Technique 4: Prompting Yourself with aCustom Prompt 23

    Technique 5: Getting There Quick withDynamic Shortcuts 30

    Technique 6: Using cd Shortcuts for Rapid Transit 34

    Technique 7: Typing Less and Doing Morewith Handy Automagic Variables 38

    Technique 8: Logging In, Logging Out 45

    Technique 9: Making History (Work for You) 50

    Technique 10: Keeping Your Life Simple withAliases and Functions 55

    Part II: Getting the Most fromYour File System 63Technique 11: Sharing Files and Printers in a

    Windows World 65

    Technique 12: Finding What You Need 73

    Technique 13: Moving Made Easy with Archives 82

    Technique 14: Downloading and Uploading Files in a Snap 88

    Technique 15: Building a Playpen withUser Mode Linux 94

    Part III: Good Housekeeping with Linux 101Technique 16: Red-lining RPM Queries 103

    Technique 17: Installing Made Easy with RPM 108

    Technique 18: Getting Comfortable with RPM 115

    Technique 19: Keeping Up-to-Date with aptand Synaptic 119

    Technique 20: Setting Up Automatic Services 126

    Technique 21: Making Your Inner SystemAdministrator Happy (And Productive) 130

    Technique 22: Spring Cleaning Essentials 137

    Part IV: Tweaking the Kernel onYour Linux System 149Technique 23: Taking Good Care of

    Your Kernel 151

    Technique 24: Creating a Custom Kernel 157

    Technique 25: Coping with the SELinuxSecurity System 164

    Technique 26: Finding Out about Your System with /proc 170

    Part V: Securing Your Workspace 177Technique 27: Closing Those Prying Eyes 179

    Technique 28: Using Encryption for Extra Security 184

    Technique 29: Securing a Large Networkwith Custom Authentication 194

    Technique 30: Customizing Authentication with PAM 203

    Technique 31: Gaining Privileges 209

    Technique 32: sudo Pseudonyms 213

    Technique 33: Securing Your Connections with SSH 218

    01b_571737ftoc.qxd 7/2/04 7:55 PM Page v

  • Part IX: Backing Up Means Never Having to Say Youre Sorry 369Technique 49: Getting Ready to Back Up

    Your Data 371

    Technique 50: Backing Up Your Data 377

    Technique 51: Quick Backup to Remote Storage 386

    Technique 52: Archiving Changes with CVS 391

    Part X: Programming Tricks 401Technique 53: Using Open-Source APIs

    to Save Time 403

    Technique 54: Timesaving PHP Tricks 414

    Technique 55: Using the DDD GraphicalDebugger with Perl 422

    Part XI: The Scary (Or Fun!) Stuff 429Technique 56: Burning CD-Rs without

    Getting Burned 431

    Technique 57: Search and Destroy setuid and setgid Programs 437

    Technique 58: Quarantining SuspiciousPrograms with UML 443

    Technique 59: Troubleshooting PersnicketyPrograms 448

    Technique 60: Securing the Fort with Bastille 455

    Technique 61: Creating a Second Lineof Defense with LIDS 467

    Technique 62: Getting Graphical with Shell Scripts 474

    Index 479

    Part VI: Networking Like a Professional 227Technique 34: Protecting Yourself

    with a Firewall 229

    Technique 35: Using VNC to Connect toRemote Desktops 239

    Technique 36: Streamlining Your NetworkSurveillance 247

    Technique 37: Evaluating Your NetworkSecurity with Nessus 255

    Technique 38: Person-to-Person Networking with IRC 265

    Part VII: Monitoring Your System 271Technique 39: Controlling Troublesome

    Processes at the Command Line 273

    Technique 40: Taking Care of New (And Old) Users 282

    Technique 41: Keeping an Eye on Your System 291

    Part VIII: Serving Up the Internet and More 305Technique 42: Keeping an Apache Server

    in Top Form 307

    Technique 43: Keeping an Eye on Your Servers 317

    Technique 44: Making a MySQL ServerYour SQL Server 328

    Technique 45: Safeguarding Your ApacheServer with SSL Certificates 340

    Technique 46: Retrieving HTTPMail Usinghotway and Evolution 349

    Technique 47: Stopping Spam with SpamAssassin 356

    Technique 48: Using Webmin to SimplifySendmail Configuration 364

    01b_571737ftoc.qxd 7/2/04 7:55 PM Page vi

  • Table of ContentsIntroduction 1

    Saving Time with This Book 1Foolish Assumptions 2Whats in This Book 2

    Part I: Making the Desktop Work for You 2Part II: Getting the Most from Your File System 3Part III: Good Housekeeping with Linux 3Part IV: Tweaking the Kernel

    on Your Linux System 3Part V: Securing Your Workspace 3Part VI: Networking Like a Professional 3Part VII: Monitoring Your System 3Part VIII: Serving Up the Internet and More 3Part IX: Backing Up Means Never

    Having to Say Youre Sorry 3Part X: Programming Tricks 4Part XI: The Scary (Or Fun!) Stuff 4

    Icons Used in This Book 4

    Part I: Making the Desktop Work for You 5

    Technique 1: Finding the Power in KDE Protocols 7Discovering Your Protocols 7Working with CD Audio Tracks Using audiocd: 8Managing Snapshots with the camera: Protocol 9Remote File Management with fish: 10Getting Help with help:, info:, and man: 10Viewing Your Local Network with the smb:

    Protocol 11Other KDE Protocols 11

    Technique 2: Getting GNOME Virtual FileSystems to Do the Work for You 13Using GNOME VFS Modules 13Stacking VFS Modules 15Working with Packages: rpm and rpms 15Putting VFS to Work at the Command Line 17Burning CDs with a VFS 17Skinning Your Desktop with VFS 17

    Technique 3: Streamlining Your Work withFile Associations 18Classifying Data with MIME 18Creating KDE File Associations 19Creating New MIME Types with GNOME 20

    Technique 4: Prompting Yourself with aCustom Prompt 23Making Basic Prompt Transformations 23Adding Dynamically Updated Data

    to Your Prompt 24Colorizing Your Prompt 26Seeing a Red Alert When You Have Superuser

    Privileges 27Saving Your Work 28

    Technique 5: Getting There Quick withDynamic Shortcuts 30Completing Names Automatically 30Using the Escape Key to Your Advantage 31Customizing Completion for Maximum Speed 32

    Technique 6: Using cd Shortcuts forRapid Transit 34Using cd and ls to Navigate through bash 34Setting Your CDPATH Variables to Find

    Directories Fast 35Remembering Where Youve Been with pushd

    and popd 36Manipulating Your Stack with dirs 36

    Technique 7: Typing Less and Doing Morewith Handy Automagic Variables 38Show Me the $$: Giving Temporary Files

    Unique Names 39Streamlining Archive Searches 39Turning the Output of a Command into a Variable

    with $( ) 40Using $UID and $EUID in Shell Scripts 41Getting Quick Access to Programs with $PATH 42Customizing Variables for Rapid Transit 43

    01b_571737ftoc.qxd 7/2/04 7:55 PM Page vii

  • Linux Timesaving Techniques For Dummiesviii

    Sharing Linux Resources with Other Computers(SMB Clients) 67

    Adjusting the workgroup name and creating user accounts 67

    Giving a Windows machine access to yourhome directory 68

    Sharing Linux files and directories with other computers 69

    Hooking Everyone Up to the Printer 69Sharing Linux printers with SWAT 69Using a Windows printer from Linux 70

    Plugging In to Remote Data with Linux Programs Quickly 71

    Technique 12: Finding What You Need 73Finding Files with locate 73Finding Files with find 74Qualifying Your Search

    with the find Command 75Doing updated filename searches 75Adding time-based qualifications 75Filtering by file size 76Joining qualifications with

    AND and OR operators 77Perusing commonly used qualifications 77

    Acting on What You Find 78Cracking open a files info with -ls 78Displaying specific info with -printf 79Checking disk usage by user 79Executing commands with find 80

    Building Complex Commands with xargs 81

    Technique 13: Moving Made Easy with Archives 82Creating Archives with File Roller 82Inspecting and Extracting Archives

    with File Roller 84Adding Functionality to tar

    with Complex Commands 85Building archives from the command line 85Archiving complex search results 86Backing up an installed package 86

    Uprooting Entire Directory Trees with scp 86Splitting Big Files into Manageable Chunks 87

    Technique 8: Logging In, Logging Out 45Finding the Right Shell Script 45

    Choosing your victims 46Timing is everything 46Cleaning up made easy 47Changing prototype scripts 48

    Customizing Your Autostart File 48

    Technique 9: Making History (Work for You) 50Navigating the History List 50

    Scrolling 50Summoning a command by number 51Searching through history 51

    Customizing the History List 52Adjusting key default settings 52Filtering the history list 52

    Executing Commands Quickly with History Variables 53

    Technique 10: Keeping Your Life Simplewith Aliases and Functions 55Viewing Your Aliases 55Creating Simple Timesaving Aliases 56Using Aliases for Complex Commands 57Automating Ted...

Recommended

View more >