O'reilly Knoppix Hacks (2Nd Edition).Pdf
Total Page:16
File Type:pdf, Size:1020Kb
SECOND EDITION KNOPPIX HACKSTM Kyle Rankin Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo Knoppix Hacks,™ Second Edition by Kyle Rankin Copyright © 2008 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (safari.oreilly.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Editor: Brian Jepson Cover Designer: Karen Montgomery Production Editor: Adam Witwer Interior Designer: David Futato Production Services: Octal Publishing, Inc. Illustrators: Robert Romano and Jessamyn Read Printing History: October 2004: First Edition. November 2007: Second Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. The Hacks series designations, Knoppix Hacks, the image of a pocket knife, “Hacks 100 Industrial-Strength Tips and Tools,” and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. Small print: The technologies discussed in this publication, the limitations on these technologies that technology and content owners seek to impose, and the laws actually limiting the use of these technologies are constantly changing. Thus, some of the hacks described in this publication may not work, may cause unintended harm to systems on which they are used, or may not be consistent with applicable user agreements. Your use of these hacks is at your own risk, and O’Reilly Media, Inc. disclaims responsibility for any damage or expense resulting from their use. In any event, you should take care that your use of these hacks does not violate any applicable laws, including copyright laws. This book uses RepKover™, a durable and flexible lay-flat binding. ISBN: 978-0-596-51493-8 [C] Contents Foreword . xi Credits . xv Preface . xix Chapter 1. Boot Knoppix . 1 1. Boot Knoppix on a Desktop 2 2. Boot Virtualized Knoppix 5 3. Get Knoppix 6 4. Use Knoppix Cheat Codes 9 5. Speak Different Languages 11 6. Free Your CD to Make Knoppix Run Faster 13 7. Straighten Out Your X Settings 16 8. Use Advanced Knoppix Cheat Codes 19 9. Run Knoppix on a Laptop 21 10. Explore Expert Mode 22 11. Check RAM for Errors with Memtest86+ 23 Chapter 2. Use Your Knoppix Desktop . 27 12. Explore the Desktop 28 13. Customize the Desktop Look 34 14. Get Office Work Done 39 15. Configure Your Printer 44 16. Use Peripheral Devices 46 17. Have Fun and Play Some Games 49 v 18. Rock Out with Knoppix Multimedia 50 19. Connect to the Internet 55 20. Connect to the Internet with GPRS Bluetooth 57 21. Explore the Internet 62 22. Get Help 65 23. Try Other Desktop Environments 66 24. Become Root 70 Chapter 3. Tweak Your Desktop . 72 25. Use Aufs 72 26. Create Persistent Knoppix Settings 75 27. Use Your Linux Desktop Settings 79 28. Use Your Windows Desktop Settings 83 29. Make a Kiosk 86 30. Make a Party Arcade 90 31. Network Boot Knoppix 94 32. Create a Knoppix “Thin Client” 96 33. Develop Applications 97 34. Install Nvidia 3D Drivers 100 35. Point-and-Klik to Install Applications 104 36. Create Your Own Klik Recipe 106 37. Install Programs to the Live Disk 107 38. Browse the Web Anonymously 109 39. Install Multimedia Codecs 111 Chapter 4. Install Linux with Knoppix . 112 40. Explore the Knoppix Installer 113 41. Install Knoppix as a Single-Boot System 118 42. Install Knoppix on a Multiboot System 120 43. Convert Knoppix to Debian Unstable 122 44. Install Gentoo with Knoppix 124 45. Update a Knoppix Install from the CD 126 vi | Contents Chapter 5. Put Knoppix in Your Toolbox . 128 46. Run Remote Desktops 129 47. Run X Remotely with FreeNX 133 48. Browse Windows Shares 138 49. Create an Emergency Router 139 50. Create an Emergency File Server 146 51. Create an Emergency Web Server 148 52. Make an Emergency Mail Relay 150 53. Run Other Emergency Services 154 54. Wardrive with Knoppix 158 55. Audit Network Security 166 56. Check for Root Kits 174 57. Collect Forensics Data 176 58. Clone Hard Drives 180 59. Wipe a Hard Drive 184 60. Test Hardware Compatibility 186 61. Copy Settings to Other Distributions 192 62. Add Knoppix to Your PXE Boot Environment 194 63. Set Up a Webcam Server in a Snap 197 64. Create a Weekend Wiki 198 Chapter 6. Repair Linux . 201 65. Repair Lilo 202 66. Repair Grub 203 67. Kill and Resurrect the Master Boot Record 205 68. Find Lost Partitions 207 69. Resize Linux Partitions 209 70. Repair Damaged Filesystems 211 71. Recover Deleted Files 214 72. Rescue Files from Damaged Hard Drives 217 73. Back Up and Restore 221 74. Migrate to a New Hard Drive 223 75. Mount Linux Software RAID 225 76. Create Linux Software RAID 227 77. Migrate to Software RAID 230 Contents | vii 78. Migrate Software RAID 1 to RAID 5 233 79. Add an Extra Drive to a Software RAID 5 Array 235 80. Mount LVM Partitions 237 81. Reset Linux Passwords 239 82. Fix Broken Init Services 240 83. Repair Debian Packages 243 84. Repair RPM Packages 245 85. Copy a Working Kernel 246 86. Turn a Physical Machine into a VMware Virtual Machine 247 Chapter 7. Rescue Windows . 253 87. Fix the Windows Boot Selector 254 88. Back Up Files and Settings 256 89. Resize Windows Partitions 258 90. Reset Lost NT Passwords 261 91. Edit the Windows Registry 264 92. Restore Corrupted System Files 267 93. Scan for Viruses 269 94. Download Windows Patches Securely 272 95. Knoppix on Intel Macs 273 Chapter 8. Knoppix Reloaded . 276 96. Master Morphix 277 97. Educate Yourself with Freeduc 279 98. Damn Small Linux 281 99. INSERT Security Here 284 100. Download Local Area Security 287 101. Full Protection with S-T-D 290 102. Distribute Compiles with distccKNOPPIX 314 103. Distribute the Load with ClusterKnoppix 315 104. Analyze Quantian 322 105. Find GIS Knoppix on the Map 325 106. TiVo Your Computer 326 107. Compose Musix 329 108. Contribute to Knoppix 331 viii | Contents Chapter 9. Knoppix Remastered . 333 109. Create a Customized Knoppix 334 110. Trim the Fat 341 111. Personalize Knoppix 344 112. Keep Your Custom Disk Up to Date 349 113. Automate Knoppix Remastering 351 114. Morph Morphix 353 115. Auto-Build Morphix Modules MapLab Tutorial Map 356 116. Change the Default Language on an ISO Image 358 117. Remaster Knoppix Without Remastering 360 118. Change Boot Defaults Without Remastering 363 119. Tweak the initrd Without Remastering 366 120. Put Knoppix on a USB Drive 367 Index . 369 Contents | ix 0 Foreword Apart from its applicability for everyday work, GNU/Linux is a great way to learn about operating systems. The Free Software license allows you to take the software apart, see inside, and understand how it works. You can also change the software to fit your needs. It can make you feel like a child hap- pily taking a colorful and complex toy apart into thousands of little gears and switches, just to see how it functions, disregarding the fact that it may be very difficult to ever reassemble that toy again. The difference with GNU/Linux, of course, is that you can work on a copy of the software source code and won’t break the original. And sometimes, while reassembling, you can build something entirely different and colorful without even planning to. The Past When, in 1999, bootable business card–sized Linux “Rescue CDs” appeared as giveaways at computer expos, I was extremely curious about how they worked. And since they were free software, I was able to look inside and try to figure out how the software worked. After I successfully made a bootable CD, I decided to make a “personal rescue CD.” That way, it would be possi- ble to use the software that I needed from a CD, rather than carry around an expensive and fragile laptop. Computers are available everywhere anyway, so why not just have the software in your pocket instead? The idea was to put in the CD and start working right away, without having to worry about installation or configuration of any kind. But hardware is evil. (Everyone knows this, even if he’s not a computer expert.) Vendors seem to create their own standards on demand, which are not standardized at all, and don’t even provide technical specifications. Compatibility in hardware depends more on luck or chance than on approved norms, so I had to decide among choosing a system that was so cheap in its hardware requirements that it would work on virtually every PC (which would probably mean that graphics worked only in VESA mode, at xi best), installing a manual hardware selector in order to load the necessary drivers, or scripting some kind of automatic configuration. For some reason, the last option seemed the most flexible and optimized solution, so I started writing scripts that would automatically install a Linux distribution on hard- ware components: identify hardware components, load the matching driv- ers, and create configuration files that are optimized for the hardware, yet tolerant enough to work around small glitches in the hardware specification.