Matthew Helmke with Andrew Hudson and Paul Hudson

Ubuntu UNLEASHED 2012 Edition Covering 11.10 and 12.04

800 East 96th Street, Indianapolis, Indiana 46240 USA Ubuntu Unleashed 2012 Edition: Covering Ubuntu 11.10 and 12.04 Editor-in Chief Copyright © 2012 by Pearson Education, Inc. Mark Taub All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, Executive Editor or otherwise, without written permission from the publisher. No patent liability is Debra Williams assumed with respect to the use of the information contained herein. Although every Cauley precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for Senior Development damages resulting from the use of the information contained herein. Editor ISBN-13: 978-0-672-33578-5 Chris Zahn ISBN-10: 0-672-33578-6 Managing Editor Library of Congress Cataloging-in-Publication Data: Kristy Hart Helmke, Matthew. Ubuntu unleashed / Matthew Helmke. — 2012 ed. Project Editor p. cm. Andrew Beaster “Covering 11.10 and 12.04.” ISBN-13: 978-0-672-33578-5 (pbk. : alk. paper) Copy Editor ISBN-10: 0-672-33578-6 (pbk. : alk. paper) Keith Cline 1. Ubuntu (Electronic resource) 2. . 3. Operating systems (Computers) I. Title. QA76.76.O63U36 2012 Indexer 005.4’32—dc23 Christine Karpeles 2011041953 Printed in the United States of America Proofreader First Printing: January 2012 Water Crest Trademarks Publishing All terms mentioned in this book that are known to be trademarks or service marks Technical Editors have been appropriately capitalized. Pearson Education, Inc. cannot attest to the accu- Kris Healy racy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Dustin Kirkland John Wregglesworth Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possi- Publishing ble, but no warranty or fitness is implied. The information provided is on an “as is” Coordinator basis. The authors and the publisher shall have neither liability nor responsibility to any Kim Boedigheimer person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the CD or programs accompanying it. Multimedia Developer Bulk Sales Dan Scherf Pearson offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact: Interior Designer Gary Adair U.S. Corporate and Government Sales 1-800-382-3419 Cover Designer [email protected] Gary Adair For sales outside of the U.S., please contact: International Sales Compositor +1-317-581-3793 Nonie Ratcliff [email protected] Contents at a Glance

About the Authors ...... xxvii

Dedication/Acknowledgements ...... xxviii

Introduction ...... 1

Part I Installation and Configuration

1 Installing Ubuntu ...... 7

2 Post-Installation Configuration ...... 19

Part II Desktop Ubuntu

3 Working with Unity ...... 35

4 On the Internet ...... 53

5 Productivity Applications ...... 67

6 Multimedia Applications ...... 77

7 Other Ubuntu Desktops...... 101

8 Games ...... 109

Part III System Administration

9 Managing Software ...... 119

10 Command-Line Quickstart ...... 133

11 Command-Line Master Class ...... 165

12 Managing Users ...... 203

13 Automating Tasks and Shell Scripting ...... 231

14 The Boot Process ...... 275

15 System-Monitoring Tools ...... 285

16 Backing Up ...... 301

17 Networking ...... 329

18 Remote Access with SSH and Telnet...... 373

19 Securing Your Machines ...... 383

20 Performance Tuning ...... 399

21 Kernel and Module Management ...... 411 iv Ubuntu Unleashed

Part IV Ubuntu as a Server

22 File and Print ...... 433

23 Apache Web Server Management ...... 455

24 Other HTTP Servers ...... 485

25 Remote File Serving with FTP ...... 491

26 Handling Email...... 501

27 Proxying and Reverse Proxying ...... 521

28 Administering Relational Database Services...... 531

29 NoSQL Databases ...... 557

30 Lightweight Directory Access Protocol (LDAP) ...... 567

31 Linux Terminal Server Project (LTSP) ...... 575

32 Virtualization on Ubuntu ...... 583

33 Ubuntu in the Cloud ...... 593

Part V Programming Linux

34 Opportunistic Development ...... 623

35 Helping with Ubuntu Testing and QA ...... 643

36 Using ...... 649

37 Using PHP...... 671

38 Using Python ...... 705

39 C/C++ Programming Tools for Ubuntu...... 725

40 Using Mono ...... 737

41 Using Other Popular Programming Languages...... 749

42 Beginning Mobile Development for Android...... 759

Part VI Appendices

A Ubuntu Under the Hood ...... 767

B Ubuntu and Linux Internet Resources ...... 777

Index ...... 787 Contents v

Table of Contents

Part I Installation and Configuration

1 Installing Ubuntu 7

Before You Begin the Installation...... 7 Researching Your Hardware Specifications ...... 8 Installation Options ...... 8 Planning Partition Strategies ...... 10 The Boot Loader...... 10 Installing from CD or DVD or USB Drive...... 11 Step-by-Step Installation...... 11 Installing ...... 12 First Update...... 16 Wubi: The Easy Installer for Windows...... 16 Shutting Down ...... 17 References...... 18

2 Post-Installation Configuration 19

Troubleshooting Post-Installation Configuration Problems ...... 19 The sudo Command ...... 21 Finding Programs and Files ...... 21 Software Update ...... 22 Configuring Software Repositories...... 25 System Settings...... 28 Installing Additional Drivers ...... 28 Detecting and Configuring a Printer ...... 30 Configuring Power Management in Ubuntu ...... 30 Setting the Date and Time ...... 31 Configuring Wireless Networks...... 33 References...... 34

Part II Desktop Ubuntu

3 Working with Unity 35

Foundations and the X Server ...... 35 Basic X Concepts...... 36 Using X ...... 37 vi Ubuntu Unleashed

Elements of the xorg.conf File ...... 38 Starting X ...... 43 Using a Display Manager ...... 43 Changing Window Managers ...... 44 Using Unity, a Primer ...... 44 The Desktop ...... 45 Customizing and Configuring Unity...... 50 Power Shortcuts ...... 50 References...... 51

4 On the Internet 53

Getting Started with Firefox ...... 54 Checking Out Google Chrome and Chromium ...... 55 Choosing an Email Client ...... 56 Evolution...... 57 Mozilla Thunderbird ...... 59 Other Mail Clients...... 59 RSS Readers ...... 60 Firefox...... 60 Liferea ...... 60 Instant Messaging and Video Conferencing with Empathy...... 61 Internet Relay Chat ...... 61 Usenet Newsgroups ...... 64 Ubuntu One Cloud Storage...... 66 References...... 66

5 Productivity Applications 67

Introducing LibreOffice...... 69 Other Office Suites for Ubuntu ...... 71 Working with GNOME Office ...... 71 Working with KOffice ...... 72 Other Useful Productivity Software ...... 73 Working with PDF ...... 73 Working with XML and DocBook ...... 74 Working with LaTeX ...... 75 Productivity Applications Written for Microsoft Windows...... 76 References...... 76

6 Multimedia Applications 77

Sound and Music ...... 77 Sound Cards ...... 78 Adjusting Volume...... 79 Contents vii

Sound Formats...... 79 Listening to Music ...... 81 Buying Music in the Ubuntu One Music Store...... 83 Graphics Manipulation ...... 85 The GNU Image Manipulation Program ...... 85 Using Scanners in Ubuntu ...... 87 Working with Graphics Formats ...... 87 Capturing Screen Images ...... 89 Using Digital Cameras with Ubuntu ...... 90 Handheld Digital Cameras ...... 90 Using Shotwell Photo Manager ...... 90 Burning CDs and DVDs in Ubuntu ...... 90 Creating CDs and DVDs with Brasero ...... 91 Creating CDs from the Command Line...... 92 Creating DVDs from the Command Line ...... 94 Viewing Video ...... 96 TV and Video Hardware ...... 96 Video Formats ...... 97 Viewing Video in Linux...... 98 Personal Video Recorders ...... 99 Video Editing ...... 99 References ...... 100

7 Other Ubuntu Desktops 101

Desktop Environment ...... 101 KDE and Kubuntu ...... 102 Xfce and Xubuntu ...... 104 LXDE and Lubuntu...... 105 GNOME...... 106 References ...... 107

8 Games 109

Ubuntu Gaming...... 109 Emulators...... 109 Installing Proprietary Video Drivers ...... 110 Installing Games in Ubuntu ...... 112 Warsow...... 112 Scorched 3D ...... 112 Frozen Bubble ...... 113 SuperTux...... 114 Battle for Wesnoth ...... 114 Frets on Fire...... 116 viii Ubuntu Unleashed

Games for Kids...... 116 Commercial Games...... 116 Playing Windows Games ...... 117 References ...... 117

Part III System Administration

9 Managing Software 119

Ubuntu Software Center ...... 119 Using Synaptic for Software Management...... 120 Staying Up-to-Date ...... 122 Working on the Command Line ...... 123 Day-to-Day Usage ...... 124 Finding Software ...... 127 Compiling Software from Source...... 128 Compiling from a Tarball ...... 128 Compiling from Source from the Ubuntu Repositories ...... 129 Server/Configuration Management...... 130 Puppet ...... 131 Chef ...... 131 Juju ...... 131 Landscape ...... 131 dotdee ...... 131 References ...... 132

10 Command-Line Quickstart 133

What Is the Command Line? ...... 134 Accessing the Command Line ...... 135 Text-Based Console Login ...... 136 Logging Out ...... 137 Logging In and Out from a Remote Computer...... 137 User Accounts...... 138 Understanding the Linux File System Hierarchy ...... 140 Essential Commands in /bin and /sbin ...... 141 Configuration Files in /etc ...... 141 User Directories: /home ...... 142 Using the Contents of the /proc Directory to Interact with the Kernel ...... 142 Working with Shared Data in the /usr Directory ...... 144 Temporary File Storage in the /tmp Directory ...... 144 Accessing Variable Data Files in the /var Directory...... 144 Contents ix

Navigating the Linux File System ...... 145 Listing the Contents of a Directory with ls...... 145 Changing Directories with cd ...... 147 Finding Your Current Directory with pwd ...... 147 Working with Permissions ...... 148 Assigning Permissions ...... 148 Directory Permissions...... 150 Altering File Permissions with chmod ...... 150 File Permissions with chgrp ...... 152 Changing File Permissions with chown...... 152 Understanding Set User ID and Set Group ID Permissions ...... 152 Working with Files ...... 153 Creating a File with touch ...... 153 Creating a Directory with mkdir ...... 154 Deleting a Directory with rmdir ...... 154 Deleting a File or Directory with rm ...... 155 Moving or Renaming a File with mv ...... 156 Copying a File with cp...... 157 Displaying the Contents of a File with cat...... 157 Displaying the Contents of a File with less ...... 157 Using Wildcards and Regular Expressions ...... 158 Working as Root...... 158 Creating Users...... 159 Deleting Users...... 160 Shutting Down the System ...... 161 Rebooting the System...... 162 Reading Documentation ...... 162 Using apropros ...... 162 Using Man Pages ...... 163 References ...... 164

11 Command-Line Master Class 165

Why Use the Command Line?...... 166 Using Basic Commands ...... 167 Printing the Contents of a File with cat ...... 168 Changing Directories with cd ...... 169 Changing File Access Permissions with chmod ...... 171 Copying Files with cp...... 171 Printing Disk Usage with du ...... 172 Finding Files by Searching with find...... 173 Searches for a String in Input with grep ...... 175 Paging Through Output with less...... 176 x Ubuntu Unleashed

Creating Links Between Files with ln ...... 178 Finding Files from an Index with locate ...... 180 Listing Files in the Current Directory with ls ...... 180 Reading Manual Pages with man ...... 182 Making Directories with mkdir ...... 183 Moving Files with mv ...... 183 Listing Processes with ps...... 184 Deleting Files and Directories with rm ...... 184 Printing the Last Lines of a File with tail...... 185 Printing Resource Usage with top ...... 186 Printing the Location of a Command with which ...... 187 Redirecting Output and Input ...... 187 Combining Commands ...... 189 Using Environment Variables ...... 191 Using Common Text Editors ...... 194 Working with nano ...... 195 Working with vi...... 196 Working with emacs ...... 197 Working with Compressed Files ...... 199 Using Multiple Terminals with byobu ...... 200 References ...... 201

12 Managing Users 203

User Accounts...... 203 The Super User/Root User ...... 204 User IDs and Group IDs ...... 206 File Permissions...... 206 Managing Groups...... 207 Group Listing...... 207 Group Management Tools ...... 208 Managing Users ...... 210 User Management Tools...... 210 Adding New Users ...... 212 Monitoring User Activity on the System ...... 216 Managing Passwords ...... 217 System Password Policy ...... 217 The Password File ...... 217 Shadow Passwords ...... 218 Managing Password Security for Users ...... 221 Changing Passwords in a Batch...... 221 Contents xi

Granting System Administrator Privileges to Regular Users ...... 221 Temporarily Changing User Identity with the su Command ...... 222 Granting Root Privileges on Occasion: The sudo Command ...... 224 Disk Quotas...... 226 Implementing Quotas ...... 227 Manually Configuring Quotas...... 228 Related Ubuntu Commands ...... 228 References ...... 229

13 Automating Tasks and Shell Scripting 231

Scheduling Tasks ...... 231 Using at and batch to Schedule Tasks for Later...... 231 Using cron to Run Jobs Repeatedly ...... 234 Basic Shell Control ...... 236 The Shell Command Line ...... 237 Shell Pattern-Matching Support ...... 239 Redirecting Input and Output...... 240 Piping Data ...... 241 Background Processing ...... 241 Writing and Executing a Shell Script ...... 242 Running the New Shell Program ...... 243 Storing Shell Scripts for Systemwide Access ...... 244 Interpreting Shell Scripts Through Specific Shells ...... 245 Using Variables in Shell Scripts ...... 246 Assigning a Value to a Variable ...... 246 Accessing Variable Values ...... 247 Positional Parameters ...... 247 A Simple Example of a Positional Parameter ...... 248 Using Positional Parameters to Access and Retrieve Variables from the Command Line ...... 248 Using a Simple Script to Automate Tasks...... 249 Built-In Variables ...... 251 Special Characters...... 252 Using Double Quotes to Resolve Variables in Strings with Embedded Spaces ...... 253 Using Single Quotes to Maintain Unexpanded Variables...... 253 Using the Backslash as an Escape Character ...... 254 Using the Backtick to Replace a String with Output ...... 255 Comparison of Expressions in pdksh and bash...... 255 Comparing Expressions with tcsh ...... 260 The for Statement ...... 264 xii Ubuntu Unleashed

The while Statement ...... 266 The until Statement ...... 268 The repeat Statement (tcsh) ...... 268 The select Statement (pdksh)...... 269 The shift Statement ...... 269 The if Statement...... 270 The case Statement ...... 271 The break and exit Statements...... 273 Using Functions in Shell Scripts ...... 273 References ...... 274

14 The Boot Process 275

Running Services at Boot ...... 275 Beginning the Boot Loading Process ...... 276 Loading the Linux Kernel...... 277 System Services and Runlevels ...... 278 Runlevel Definitions ...... 278 Booting into the Default Runlevel ...... 279 Understanding init Scripts and the Final Stage of Initialization ...... 279 Controlling Services at Boot with Administrative Tools ...... 280 Changing Runlevels ...... 281 Troubleshooting Runlevel Problems ...... 282 Starting and Stopping Services Manually ...... 283 Using Upstart ...... 283 References ...... 284

15 System-Monitoring Tools 285

Console-Based Monitoring ...... 285 Using the kill Command to Control Processes ...... 287 Using Priority Scheduling and Control ...... 288 Displaying Free and Used Memory with free ...... 290 Disk Space ...... 291 Disk Quotas ...... 291 Graphical Process and System Management Tools ...... 292 System Monitor...... 292 Conky ...... 294 Other ...... 298 KDE Process- and System-Monitoring Tools...... 299 Enterprise Server Monitoring ...... 299 Landscape ...... 299 Other ...... 299 References ...... 300 Contents xiii

16 Backing Up 301

Choosing a Backup Strategy ...... 301 Why Data Loss Occurs...... 302 Assessing Your Backup Needs and Resources ...... 303 Evaluating Backup Strategies...... 305 Making the Choice ...... 307 Choosing Backup Hardware and Media ...... 308 Removable Storage Media ...... 308 CD-RW and DVD+RW/-RW Drives...... 308 Network Storage ...... 309 Tape Drive Backup ...... 309 Cloud Storage ...... 310 Using Backup Software ...... 310 tar: The Most Basic Backup Tool ...... 310 The GNOME File Roller ...... 312 The KDE ark Archiving Tool ...... 313 Déjà Dup ...... 313 Back In Time ...... 315 Unison ...... 317 Using the Amanda Backup Application ...... 318 Alternative Backup Software ...... 319 Copying Files...... 319 Copying Files Using tar...... 319 Compressing, Encrypting, and Sending tar Streams ...... 320 Copying Files Using cp ...... 321 Copying Files Using mc ...... 321 Using rsync ...... 322 Version Control for Configuration Files...... 323 System Rescue...... 326 The Ubuntu Rescue Disc ...... 326 Restoring the GRUB2 Boot Loader ...... 326 Saving Files from a Nonbooting Hard Drive ...... 327 References ...... 328

17 Networking 329

Laying the Foundation: The localhost Interface ...... 330 Checking for the Availability of the Loopback Interface ...... 330 Configuring the Loopback Interface Manually ...... 330 Networking with TCP/IP...... 333 TCP/IP Addressing ...... 334 Using IP Masquerading in Ubuntu...... 336 Ports...... 336 xiv Ubuntu Unleashed

Network Organization ...... 337 Subnetting...... 337 Subnet Masks ...... 338 Broadcast, Unicast, and Multicast Addressing ...... 338 Hardware Devices for Networking ...... 339 Network Interface Cards ...... 339 Network Cable ...... 341 Hubs and Switches...... 342 Routers and Bridges ...... 343 Initializing New Network Hardware ...... 344 Using Network Configuration Tools...... 346 Command-Line Network Interface Configuration...... 346 /bin/netstat...... 350 Network Configuration Files ...... 351 Using Graphical Configuration Tools ...... 353 Dynamic Host Configuration Protocol ...... 355 How DHCP Works ...... 355 Activating DHCP at Installation and Boot Time ...... 356 DHCP Software Installation and Configuration...... 357 Using DHCP to Configure Network Hosts ...... 359 Other Uses for DHCP ...... 361 Wireless Networking ...... 361 Support for Wireless Networking in Ubuntu ...... 361 Advantages of Wireless Networking ...... 363 Choosing from Among Available Wireless Protocols ...... 363 Beyond the Network and onto the Internet ...... 364 Common Configuration Information ...... 364 Configuring Digital Subscriber Line Access ...... 366 Understanding PPP over Ethernet ...... 366 Configuring a PPPoE Connection Manually ...... 367 Configuring Dial-Up Internet Access...... 368 Troubleshooting Connection Problems...... 369 References ...... 370

18 Remote Access with SSH and Telnet 373

Setting Up a Telnet Server ...... 373 Telnet Versus SSH ...... 375 Setting Up an SSH Server ...... 375 SSH Tools ...... 375 Using scp to Copy Individual Files Between Machines ...... 376 Using sftp to Copy Many Files Between Machines...... 377 Using ssh-keygen to Enable Key-Based Logins ...... 377 Contents xv

Virtual Network Computing ...... 379 References ...... 382

19 Securing Your Machines 383

Understanding Computer Attacks ...... 383 Assessing Your Vulnerability ...... 385 Protecting Your Machine ...... 386 Securing a Wireless Network ...... 387 Passwords and Physical Security ...... 387 Configuring and Using Tripwire ...... 388 Devices ...... 389 Viruses ...... 389 Configuring Uncomplicated Firewall ...... 390 AppArmor ...... 392 Forming a Disaster Recovery Plan...... 395 References ...... 396

20 Performance Tuning 399

Hard Disk...... 399 Using the BIOS and Kernel to Tune the Disk Drives ...... 400 The hdparm Command...... 401 File System Tuning...... 402 The tune2fs Command ...... 402 The e2fsck Command...... 403 The badblocks Command ...... 403 Disabling File Access Time...... 403 Kernel ...... 404 Apache ...... 405 MySQL ...... 406 Measuring Key Buffer Usage ...... 406 Using the Query Cache...... 408 Miscellaneous Tweaks...... 409 Query Optimization ...... 410 References ...... 410

21 Kernel and Module Management 411

The Linux Kernel ...... 412 The Linux Source Tree ...... 413 Types of Kernels ...... 415 Managing Modules ...... 416 When to Recompile ...... 418 Kernel Versions ...... 419 xvi Ubuntu Unleashed

Obtaining the Kernel Sources ...... 420 Patching the Kernel ...... 421 Compiling the Kernel...... 422 Using xconfig to Configure the Kernel...... 425 Creating an Initial RAM ...... 429 When Something Goes Wrong ...... 429 Errors During Compile ...... 429 Runtime Errors, Boot Loader Problems, and Kernel Oops ...... 430 References ...... 431

Part IV Ubuntu as a Server

22 File and Print 433

Using the Network File System ...... 434 Installing and Starting or Stopping NFS ...... 434 NFS Server Configuration ...... 434 NFS Client Configuration...... 436 Putting to Work ...... 437 Manually Configuring Samba with /etc/samba/smb.conf...... 438 Testing Samba with the testparm Command...... 442 Starting, Stopping, and Restarting the smbd Daemon...... 442 Mounting Samba Shares ...... 443 Configuring Samba Using SWAT...... 444 Network and Remote Printing with Ubuntu ...... 448 Creating Network Printers ...... 448 Using the Common UNIX Printing System GUI...... 450 Avoiding Printer Support Problems ...... 453 References ...... 454

23 Apache Web Server Management 455

About the Apache Web Server...... 455 Installing the Apache Server ...... 457 Installing from the Ubuntu Repositories ...... 457 Building the Source Yourself ...... 458 Starting and Stopping Apache ...... 460 Starting the Apache Server Manually...... 461 Using /etc/init.d/apache2 ...... 462 Runtime Server Configuration Settings...... 463 Runtime Configuration Directives ...... 464 Editing apache2.conf ...... 464 Apache Multiprocessing Modules ...... 467 Using .htaccess Configuration Files...... 467 Contents xvii

File System Authentication and Access Control ...... 469 Restricting Access with allow and deny ...... 470 Authentication ...... 471 Final Words on Access Control...... 473 Apache Modules...... 474 mod_access ...... 475 mod_alias ...... 475 mod_asis ...... 475 mod_auth ...... 476 mod_auth_anon ...... 476 mod_auth_dbm...... 476 mod_auth_digest ...... 476 mod_autoindex ...... 477 mod_cgi ...... 477 mod_dir and mod_env...... 477 mod_expires ...... 477 mod_headers ...... 477 mod_include ...... 478 mod_info and mod_log_config ...... 478 mod_mime and mod_mime_magic ...... 478 mod_negotiation ...... 478 mod_proxy ...... 478 mod_rewrite ...... 478 mod_setenvif...... 479 mod_speling ...... 479 mod_status ...... 479 mod_ssl ...... 479 mod_unique_id ...... 479 mod_userdir ...... 479 mod_usertrack ...... 479 mod_vhost_alias ...... 479 Virtual Hosting ...... 480 Address-Based Virtual Hosts...... 480 Name-Based Virtual Hosts ...... 481 Logging ...... 482 References ...... 484

24 Other HTTP Servers 485

Nginx...... 485 lighttpd ...... 487 Yaws ...... 488 Cherokee ...... 488 xviii Ubuntu Unleashed

Jetty ...... 489 thttpd ...... 489 Apache Tomcat ...... 490 References ...... 490

25 Remote File Serving with FTP 491

Choosing an FTP Server...... 491 Choosing an Authenticated or Anonymous Server ...... 492 Ubuntu FTP Server Packages ...... 492 Other FTP Servers ...... 492 Installing FTP Software ...... 493 The FTP User ...... 494 Configuring the Very Secure FTP Server...... 496 Controlling Anonymous Access ...... 497 Other vsftpd Server Configuration Files ...... 498 Using the ftphosts File to Allow or Deny FTP Server Connection ...... 499 References ...... 500

26 Handling Email 501

How Email Is Sent and Received ...... 501 The Mail Transport Agent ...... 502 Choosing an MTA...... 504 The Mail Delivery Agent ...... 504 The Mail User Agent ...... 505 Basic Postfix Configuration and Operation ...... 506 Configuring Masquerading...... 508 Using Smart Hosts ...... 509 Setting Message Delivery Intervals ...... 509 Mail Relaying...... 510 Forwarding Email with Aliases ...... 510 Using Fetchmail to Retrieve Mail...... 511 Installing Fetchmail ...... 511 Configuring Fetchmail...... 511 Choosing a Mail Delivery Agent ...... 515 Procmail ...... 515 Spamassassin ...... 515 Squirrelmail ...... 516 Virus Scanners ...... 516 Autoresponders ...... 516 Alternatives to Microsoft Exchange Server ...... 516 Microsoft Exchange Server/Outlook Client...... 517 CommuniGate Pro...... 517 Contents xix

Oracle Beehive ...... 517 Bynari...... 518 Open-Xchange ...... 518 phpgroupware...... 518 PHProjekt ...... 518 Horde ...... 518 References ...... 519

27 Proxying and Reverse Proxying 521

What Is a Proxy Server? ...... 521 Installing Squid...... 522 Configuring Clients ...... 522 Access Control Lists ...... 523 Specifying Client IP Addresses ...... 527 Sample Configurations ...... 528 References ...... 530

28 Administering Relational Database Services 531

A Brief Review of Database Basics ...... 532 How Relational Databases Work ...... 533 Understanding SQL Basics ...... 536 Creating Tables...... 536 Inserting Data into Tables ...... 537 Retrieving Data from a Database ...... 538 Choosing a Database: MySQL Versus PostgreSQL ...... 540 Speed ...... 540 Data Locking ...... 541 ACID Compliance in Transaction Processing to Protect Data Integrity ...... 542 SQL Subqueries ...... 542 Procedural Languages and Triggers...... 542 Configuring MySQL...... 543 Setting a Password for the MySQL Root User ...... 544 Creating a Database in MySQL...... 544 Configuring PostgreSQL ...... 546 Initializing the Data Directory in PostgreSQL ...... 547 Creating a Database in PostgreSQL ...... 547 Creating Database Users in PostgreSQL...... 548 Deleting Database Users in PostgreSQL ...... 548 Granting and Revoking Privileges in PostgreSQL ...... 549 Database Clients ...... 550 SSH Access to a Database ...... 550 Local GUI Client Access to a Database...... 551 xx Ubuntu Unleashed

Web Access to a Database...... 552 The MySQL Command-Line Client ...... 553 The PostgreSQL Command-Line Client ...... 555 Graphical Clients...... 555 References ...... 556

29 NoSQL Databases 557

Key/Value Stores...... 559 Berkeley DB ...... 560 Cassandra...... 560 Memcached and MemcacheDB ...... 561 Redis ...... 561 Document Stores ...... 562 CouchDB ...... 562 MongoDB...... 563 BaseX ...... 564 Wide Column Stores ...... 564 BigTable ...... 565 HBase ...... 565 References ...... 565

30 Lightweight Directory Access Protocol (LDAP) 567

Configuring the Server ...... 568 Creating Your Schema ...... 568 Populating Your Directory ...... 570 Configuring Clients ...... 572 Evolution ...... 572 Thunderbird ...... 572 Administration ...... 572 References ...... 574

31 Linux Terminal Server Project (LTSP) 575

Requirements ...... 576 Installation...... 579 Using LTSP ...... 580 References ...... 581

32 Virtualization on Ubuntu 583

KVM ...... 585 VirtualBox...... 589 VMware ...... 591 Xen...... 591 References ...... 591 Contents xxi

33 Ubuntu in the Cloud 593

Why a Cloud?...... 594 Ubuntu Cloud and Eucalyptus...... 595 Deploy/Install Basics: Public or Private?...... 596 Public ...... 597 Private ...... 598 A euca2ools Primer...... 601 Ubuntu Cloud and OpenStack ...... 603 Compute Infrastructure (Nova) ...... 603 Storage Infrastructure (Swift) ...... 604 Imaging Service (Glance) ...... 604 Installation ...... 604 Creating an Image ...... 614 Instance Management ...... 617 Storage Management...... 617 Network Management ...... 618 An OpenStack Commands Primer...... 618 Learning More ...... 618 Landscape ...... 619 Juju...... 619 Orchestra ...... 620 References ...... 620

Part V Programming Linux

34 Opportunistic Development 623

Version Control Systems...... 624 Managing Software Projects with Subversion ...... 624 Managing Software Projects with Bazaar ...... 625 Managing Software Projects with Mercurial ...... 626 Managing Software Projects with Git ...... 627 Introduction to Opportunistic Development ...... 628 Launchpad ...... 629 Quickly...... 631 Ground Control ...... 635 Bikeshed and Other Tools ...... 638 References ...... 641

35 Helping with Ubuntu Testing and QA 643

Community Teams ...... 643 Ubuntu Testing Team ...... 644 QA Team ...... 645 xxii Ubuntu Unleashed

Bug Squad ...... 645 Test Drive...... 645 References ...... 648

36 Using Perl 649

Using Perl with Linux ...... 649 Perl Versions ...... 650 A Simple Perl Program ...... 650 Perl Variables and Data Structures ...... 652 Perl Variable Types ...... 653 Special Variables ...... 653 Operators ...... 654 Comparison Operators ...... 654 Compound Operators...... 655 Arithmetic Operators...... 655 Other Operators ...... 656 Special String Constants ...... 657 Conditional Statements: if/else and unless ...... 657 if ...... 657 unless ...... 658 Looping ...... 658 for...... 659 foreach ...... 659 while...... 660 until...... 660 last and next ...... 660 do ... while and do ... until ...... 661 Regular Expressions ...... 661 Access to the Shell ...... 662 Modules and CPAN...... 663 Code Examples ...... 664 Sending Mail ...... 664 Purging Logs ...... 666 Posting to Usenet ...... 667 One-Liners ...... 668 Command-Line Processing ...... 668 References ...... 669

37 Using PHP 671

Introduction to PHP ...... 672 Entering and Exiting PHP Mode ...... 672 Variables ...... 673 Contents xxiii

Arrays ...... 674 Constants...... 676 References ...... 676 Comments ...... 677 Escape Sequences...... 677 Variable Substitution ...... 679 Operators ...... 679 Conditional Statements ...... 681 Special Operators ...... 683 Switching ...... 683 Loops ...... 685 Including Other Files...... 687 Basic Functions ...... 688 Strings ...... 688 Arrays ...... 692 Files ...... 693 Miscellaneous ...... 696 Handling HTML Forms...... 699 Databases ...... 700 References ...... 702

38 Using Python 705

Python on Linux ...... 706 The Basics of Python...... 707 Numbers ...... 707 More on Strings...... 709 Lists ...... 712 Dictionaries ...... 714 Conditionals and Looping...... 715 Functions...... 717 Object Orientation ...... 718 Class and Object Variables ...... 719 Constructors and Destructors...... 720 Class Inheritance ...... 721 The Standard Library and the Python Package Index ...... 722 References ...... 723

39 C/C++ Programming Tools for Ubuntu 725

Programming in C with Linux ...... 726 Using the C Programming Project Management Tools Provided with Ubuntu...... 727 Building Programs with make ...... 727 Using Makefiles ...... 727 xxiv Ubuntu Unleashed

Using the autoconf Utility to Configure Code ...... 729 Debugging Tools...... 730 Using the GNU C Compiler ...... 731 Graphical Development Tools...... 732 Using the KDevelop Client ...... 732 The Glade Client for Developing in GNOME ...... 733 References ...... 734

40 Using Mono 737

Why Use Mono? ...... 738 MonoDevelop ...... 739 The Structure of a C# Program ...... 741 Printing Out the Parameters ...... 743 Creating Your Own Variables ...... 743 Adding Some Error Checking...... 744 Building on Mono’s Libraries...... 745 Creating a GUI with Gtk# ...... 745 References ...... 746

41 Using Other Popular Programming Languages 749

Ada ...... 750 Clojure ...... 750 COBOL...... 751 Erlang ...... 752 Forth...... 752 Fortran ...... 753 Groovy ...... 753 Haskell ...... 754 Java ...... 754 JavaScript ...... 755 Lisp...... 755 Lua ...... 756 Ruby ...... 756 Scala ...... 756 Vala ...... 757 References ...... 757

42 Beginning Mobile Development for Android 759

Introduction to Android ...... 760 Hardware ...... 760 Linux Kernel...... 760 Contents xxv

Libraries ...... 760 Android Runtime...... 760 Application Framework...... 761 Applications ...... 761 Installing the Android SDK ...... 761 Install Java ...... 761 Install Eclipse...... 761 Install the SDK ...... 762 Install the ADT Eclipse Plug-In...... 762 Install Other Components...... 762 Install Virtual Devices ...... 763 Create Your First Application ...... 764 References ...... 765

Part VI Appendices

A Ubuntu Under the Hood 767

What Is Linux? ...... 767 Why Use Linux? ...... 769 What Is Ubuntu?...... 770 Ubuntu for Business...... 771 Ubuntu in Your Home...... 773 64-Bit Ubuntu...... 773 Getting the Most from Ubuntu and Linux Documentation...... 773 Ubuntu Developers and Documentation ...... 775 References ...... 775

B Ubuntu and Linux Internet Resources 777

Websites and Search Engines ...... 778 Web Search Tips ...... 778 Google Is Your Friend ...... 779 Ubuntu Package Listings ...... 779 Certification ...... 779 Commercial Support ...... 780 Documentation ...... 780 Linux Guides ...... 781 Ubuntu ...... 781 Mini-CD Linux Distributions ...... 781 Various Intel-Based Linux Distributions ...... 782 PowerPC-Based Linux Distributions ...... 782 xxvi Ubuntu Unleashed

Linux on Laptops and PDAs ...... 783 The X Window System ...... 783 Usenet Newsgroups ...... 783 Mailing Lists...... 784 Ubuntu Project Mailing Lists ...... 785 Internet Relay Chat ...... 785

Index 787 About the Authors

Matthew Helmke is an active member of the Ubuntu community. He served from 2006 to 2011 on the Ubuntu Forum Council, providing leadership and oversight of the Ubuntu Forums (www.ubuntuforums.org), and spent two years on the Ubuntu regional mem- bership approval board for Europe, the Middle East, and Africa. He has written about Ubuntu for several magazines and websites, is a lead author of The Official Ubuntu Book, and coauthored The VMware Cookbook. He works for The iPlant Collaborative (www.iplantcollaborative.org), which is funded by the National Science Foundation and is building the world’s first cyberinfrastructure for the biological sciences. Matthew first used Unix in 1987 while studying LISP on a Vax at the university. He has run a business using only free and open source software, has consulted, and has recently completed a master’s degree in Information Resources and Library Science from the University of Arizona. You can find out more about Matthew at matthewhelmke.com or drop him a line with errata or suggestions at [email protected]. Andrew Hudson is a freelance journalist who specializes in writing about Linux. He has significant experience in Red Hat and Debian-based Linux distributions and deployments and can often be found sitting at his keyboard tweaking various settings and config files just for the hell of it. He lives in Wiltshire, which is a county of England, along with his wife, Bernice, and their son, John. Andrew does not like Emacs. He can be reached at [email protected]. Paul Hudson is a recognized expert in open-source technologies. He is also a professional developer and full-time journalist for Future Publishing. His articles have appeared in MacFormat, PC Answers, PC Format, PC Plus, and Linux Format. Paul is passionate about free software in all its forms and uses a mix of Linux and BSD to power his desktops and servers. Paul likes Emacs. Paul can be contacted through http://hudzilla.org. Dedication

To Heather, Saralyn, Sedona, and Philip—the most amazing family a guy could hope for, to my grandfather for always believing in me and teaching me to believe in myself, and to my friends in the Ubuntu, developer, sysadmin, and DevOps communities. —Matthew Helmke

Acknowledgments

I am solely responsible for this edition of Ubuntu Unleashed but freely acknowledge that I am standing on the shoulders of giants. I want to express my gratitude to Andrew and Paul Hudson for the solid foundation that past editions of the book (up to Ubuntu Unleashed 2008) provided to this update. Thanks to Ryan Troy for helping with the 2010 edition. Thank you to the many people who helped with technical edits and both formal and informal advice, especially Andrew Lenards, John Wregglesworth, Kris Healy, Dustin Kirkland, and several developers who wanted to remain anonymous. A huge debt of grati- tude is owed to the Ubuntu community, Canonical, and Mark Shuttleworth for inviting me to participate in the community, including my role in the forums, a turn on the EMEA membership board, and two Ubuntu Developer Summits. Thanks to the Ubuntu All Stars for the chance to jam with you on guitar. Thank you to the entire Ubuntu commu- nity for your labor of love to create this wonderful . Finally, thanks to my colleagues at Pearson, especially Debra Williams Cauley, for the trust placed in me and the opportunity to collaborate on projects like this one. —Matthew Helmke We Want to Hear from You!

As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what we’re doing right, what we could do better, what areas you’d like to see us publish in, and any other words of wisdom you’re willing to pass our way. I welcome your comments. You can email or write me directly to let me know what you did or didn’t like about this book—as well as what we can do to make our books better. Please note that I cannot help you with technical problems related to the topic of this book. We do have a User Services group, however, where I will forward specific technical questions related to the book. Email: [email protected] Mail: Debra Williams Cauley Sams Publishing 800 East 96th Street Indianapolis, IN 46240 USA When you write, please be sure to include this book’s title and author as well as your name, email address, and phone number. I will carefully review your comments and share them with the author and editors who worked on the book.

Reader Services

Visit our website and register this book at informit.com/register for convenient access to any updates, downloads, or errata that might be available for this book. This page intentionally left blank CHAPTER 10 IN THIS CHAPTER

. What Is the Command Line? Command-Line . Accessing the Command Line Quickstart . User Accounts . Understanding the Linux File System Hierarchy . Navigating the Linux File System . The Linux command line is one of the most powerful Working with Permissions tools available for computer system administration and . Working with Files maintenance. The command line is also known as the . Working as Root terminal, shell, the console, the command prompt, and the command-line interface (CLI). For the purposes of this chapter . Reading Documentation and the next, these terms are interchangeable, although . References fine-grained differences do exist between them. The command line is an efficient way to perform complex tasks accurately and much more easily than it would seem at a first glance. Knowledge of the commands available to you and also how to string them together will make using Ubuntu even easier for many tasks. Many of the commands were created by the GNU Project as free software analogs to previously existing proprietary UNIX commands. If you are interested, you can learn more about the GNU Project at www.gnu.org/gnu/thegnuproject.html. This chapter looks at some of the basic commands that you need to know to be productive at the command line. You will find out how to get to the command line and learn some of the commands used to navigate the file system and perform basic operations with files, directories, and users. This chapter does not give comprehensive coverage of all the commands discussed, but only enough to get you started. Chapter 11, “Command-Line Master Class,” advances the subject further while expanding on some of the commands from this chapter. The skills you learn in this chapter will help you get started using the command line with confidence. 134 CHAPTER 10 Command-Line Quickstart

What Is the Command Line?

If you spend any amount of time with experienced Linux users, you will hear them mention the command line. Some, especially those who have begun their journey in the Linux world using distributions, like Ubuntu, that make it easy to complete many tasks using a graphical user interface (GUI), may speak with trepidation about the mysteries of the text interface. Others will either praise its power or comment about doing something via the command line as if it is the most natural and obvious way to complete a task. It is not necessary for you to embrace either extreme. You may develop an affinity for the command line when performing some tasks and prefer the GUI for others. This is where most users end up today. Some may say that you will never need to access the command line because Ubuntu offers a slew of graphical tools that enable you to configure most things on your system. Although the premise may be true most of the time, there are some good reasons to acquire a fundamental level of comfort with the command line that you should consider before embracing that view. Sometimes things go wrong, and you may not have the luxury of a graphical interface to work with. In these situations, a fundamental understanding of the command line and its uses can be a real lifesaver. Also, some tasks end up being far easier and faster to accom- plish from the command line. More important, though, you will be able to make your way around a command-line-based system, which you will encounter if you ever work with a Linux server because most Linux servers have no GUI and all administration is done using a command-line interface.

NOTE Don’t be tempted to skip over this chapter as irrelevant. You should take the time to work through the chapter and ensure that you are comfortable with the command line before moving on. Doing so will benefit you greatly for years to come.

Initially, some may be tempted to think of the command line as the product of some sort of black and arcane art, and in some ways, it can appear to be extremely difficult and complicated to use. However, with a little perseverance, by the end of this chapter, you will start to feel comfortable using the command line and you’ll be ready to move on to Chapter 11. This chapter introduces you to commands that enable you to perform the following: . Routine tasks—Logging in and out, changing passwords, and listing and navigating file directories. . Basic file management—Creating files and folders, copying or moving them around the file system, and renaming and deleting them. . Basic system management—Shutting down or rebooting, changing file permissions, and reading man pages, which are entries for commands included as files already on your computer in a standardized manual format Accessing the Command Line 135

The information in this chapter is valuable for individual users or system administrators who are new to Linux and are learning to use the command line for the first time.

TIP Those of you who have used a computer for many years will probably have come into contact with MS-DOS, in which case being presented with a black screen will fill you with a sense of nostalgia. Don’t get too comfy; the command line in Linux is different from (and actually more powerful than) its distant MS-DOS cousin. Even cooler is that whereas MS-DOS skills are transferable only to other MS-DOS environments, the skills that you learn at the Linux command line can be transferred easily to other UNIX and UNIX-like operating systems, such as Solaris, OpenBSD, FreeBSD, and even Mac OS X, which provides access to the terminal.

Accessing the Command Line

You can quickly access the terminal using the desktop menu option Terminal. This opens gnome-terminal, from which you can access the terminal while remaining in a GUI envi- ronment. This time, the terminal appears as white text on an aubergine (dark purple) background. This is the most common method for accessing the terminal for most desktop users.

NOTE Finding and running programs, such as Terminal, from a GUI is covered in Chapter 3, “Working with Unity,” as is logging it to a Linux system using a graphical interface. This chapter focuses on text-based logins and the use of Linux.

The second most common way for graphical desktop users to access the command line is to press the key combination Ctrl+Alt+F1, after which Ubuntu switches to a black screen and a login prompt like this:

Ubuntu 11.10 oneric seymour ttyl seymour login: 10

TIP This is tty1, one of six virtual consoles that Ubuntu provides. After you have accessed a virtual console, you can use the Ctrl+Alt + any of F1 through F6 to switch to a different console, tty1 through tty6. If you want to get back to the graphical interface, press Ctrl+Alt+F7. You can also switch between consoles by holding the Alt key and pressing either the left or the right cursor key to move down or up a console, such as tty1 to tty2. 136 CHAPTER 10 Command-Line Quickstart

Regardless of which way you access the terminal, using the virtual tty consoles accessible at Ctrl+Alt+F1-6 or via the windowed version atop your GUI desktop, you will find the rest of the usage details that we cover work the same. As you continue to learn and exper- iment beyond the contents of this book, you may start to discover some subtle differ- ences between the two and develop a preference. For our purposes, either method works quite well. There are many other ways to access and use the command line. You could use a tradi- tional console with a monitor, keyboard, and mouse attached to the PC, but which boots into a command-line interface instead of a GUI. You can also connect to your system through a wired or wireless network using the telnet or ssh commands, as covered in Chapter 18, “Remote Access with SSH and Telnet.” With that, let’s begin.

Text-Based Console Login

However you connect to a command-line interface, you start with a prompt similar to this one:

Ubuntu 11.10 oneric seymour ttyl seymour login:

Your prompt might vary, depending on the version of Ubuntu you are using and the method you are using to connect. In any event, at this prompt, type in your username and press Enter. When you are prompted for your password, type it in and press Enter.

NOTE Your password is not echoed back to you, which is a good idea. Why is it a good idea? Well, people are prevented from looking over your shoulder and seeing your screen input. It is not difficult to guess that a five-letter password might correspond to the user’s spouse’s first name.

At the login prompt, type your username and press the Enter key. You are asked for your password, which you type. Note that Ubuntu does not show any characters while you are typing in your password. This is a good thing because it prevents any shoulder surfers from seeing what you’ve typed or the length of the password. Pressing the Enter key drops you to a shell prompt, signified by the dollar sign: matthew@seymour:~$

This particular prompt tells me that I am logged in as the user matthew on the system seymour and I am currently in my home directory; Linux uses the tilde (~) as shorthand for the home directory, which would usually be something like /home/matthew. Accessing the Command Line 137

TIP Navigating through the system at the command line can get confusing at times, espe- cially when a directory name occurs in several places. Fortunately, Linux includes a simple command that tells you exactly where you are in the file system. It’s easy to remember because the command is just an abbreviation of present working directory, so type pwd at any point to get the full path of your location. For example, typing pwd after following these instructions shows /home/yourusername, meaning that you are currently in your home directory. Using the pwd command can save you a lot of frustration when you have changed your directory half a dozen times and have lost track.

Logging Out

Use the exit or logout command or Ctrl+D to exit your session. You are then returned to the login prompt. If you use virtual consoles, remember to exit each console before leaving your PC. (Otherwise, someone could easily sit down and use your account.) Logging In and Out from a Remote Computer

Although you can happily log in on your computer, an act known as a local login, you can also log in to your computer via a network connection from a remote computer. Linux-based operating systems provide a number of remote access commands you can use to log in to other computers on your local area network (LAN), wide area network (WAN),or the Internet. Note that you must have an account on the remote computer and the remote computer must be configured to support remote logins; otherwise, you won’t be able to log in.

NOTE See Chapter 17, “Networking,” to see how to set up network interfaces with Linux to support remote network logins and Chapter 18 to see how to start remote access ser- vices (such as sshd).

The best and most secure way to log in to a remote Linux computer is to use ssh, the Secure Shell client. Your login and session are encrypted while you work on the remote computer. The ssh client features many command-line options, but can be simply used with the name or IP address of the remote computer, as follows: 10 matthew@seymour:~$ ssh 192.168.0.41 The authenticity of host ‘192.168.0.41 (192.168.0.41)’ can’t be established. RSA key fingerprint is e1:db:6c:da:3f:fc:56:1b:52:f9:94:e0:d1:1d:31:50. Are you sure you want to continue connecting (yes/no)? yes 138 CHAPTER 10 Command-Line Quickstart

The first time you connect with a remote computer using ssh, Linux displays the remote computer’s encrypted identity key and asks you to verify the connection. After you type yes and press Enter, you are warned that the remote computer’s identity (key) has been entered in a file named known_hosts under the .ssh directory in your home directory. You are also prompted to enter your password:

Warning: Permanently added ‘192.168.0.41’ (RSA) \ to the list of known hosts. [email protected]’s password: matthew@babbage~$

After entering your password, you can work on the remote computer, which you can confirm by noticing the changed prompt that now uses the name of the remote computer on which you are working. Again, because you are using ssh, everything you enter on the keyboard in communication with the remote computer is encrypted. When you log out, you return to the shell on your computer: matthew@babbage~$ logout matthew@seymour:~$

User Accounts

A good place to start is with the concept of user-based security. For the most part, only two types of people will access the system as users. (Although there will be other accounts that run programs and processes, here we are talking about accounts that represent human beings rather than something like an account created for a web server process.) Most people have a regular user account. These users can change anything that is specific to their account, such as the wallpaper on the desktop, their personal preferences, and the configuration for a program when it is run by them using their account. Note that the emphasis is on anything that is specific to their account. This type of user cannot make systemwide changes that could affect other users. To make systemwide changes, you need to use super-user privileges, such as can be done using the account you created when you started Ubuntu for the first time (see Chapter 1, “Installing Ubuntu”). With super-user privileges, you have access to the entire system and can carry out any task, even destructive ones. To help prevent this from happening, this user does not run with these powers enabled at all times, but instead spends most of the time as a regular user. To use super-user privileges from the command line, you need to preface the command you want to execute with another command, sudo, followed by a space and the command you want to run. As a mnemonic device, some think of this as “super user do.” When you press Enter (after typing the remaining command), you are prompted for your password, which you should type in followed by the Enter key. As usual on any UNIX-based system, the password does not appear on the screen while you are typing it as a security measure, User Accounts 139

in case someone is watching over your shoulder. Ubuntu then carries out the command, but with super-user privileges. An example of the destructive nature of working as the super user can be found in the age-old example, sudo rm -rf /, which erases everything on your hard drive. If you enter a command using sudo as a regular user who does not have an account with super-user privileges, an error message appears and nothing happens because the command will not run. We recommend that you don’t try this particular command as a test, though. If you enter this command using an account with super-user privileges, you will soon find your- self starting over with a fresh installation and hoping you have a current backup of all of your data. You need to be especially careful when using your super-user privileges; other- wise, you may do irreparable damage to your system.

However, the ability to work as the super user is fundamental to a healthy Linux system and should not be feared, but rather respected, even while used only with focused atten- tion. Without this ability, you could not install new software, edit system configuration files, or do a large number of important administration tasks. By the way, you have already been performing operations with super-user privileges from the GUI if you have ever been asked to enter your password to complete a specific task, such as installing soft- ware updates. The difference is that most graphical interfaces limit the options that users have and make it a little more difficult to do some of the big, disruptive tasks, even the ones that are incredibly useful. Ubuntu works slightly differently from many other Linux distributions. If you study some other Linux distros, especially older or more traditional ones, you will hear about a specific user account called root, which is a super-user account. In those distros, instead of typing in sudo before a command while using a regular user account with super-user privi- leges, you log in to the root account and simply issue the command without entering a password (at least by default; in almost all cases, sudo can be installed and configured in these distros). In those cases, you can tell when you are using the root account at the command line because you will see a pound sign (#) in the command-line prompt in the place of the dollar sign ($).

For example: matthew@seymour:~# versus the usual matthew@seymour:~$ In Ubuntu, the root account is disabled by default because forcing regular users with super-user privileges to type a specific command every time they want to execute a command as a super user should have the benefit of making them carefully consider what they are doing when they use that power. It is easy to forget to log out of a root account, and entering a powerful command while logged in to root can be catastrophic. However, if you are more experienced and comfortable with the more traditional method of using 10 super-user privileges and want to enable the root account, you can use the command sudo passwd. When prompted, enter your user password to confirm that your user account has super-user privileges. You are then asked for a new UNIX password, which will be the password for the root account, so make sure and remember it. You are also prompted to repeat the password, in case you’ve made any mistakes. After you’ve typed it in and pressed Enter, the root account is active. You’ll find out how to switch to root later on. 140 CHAPTER 10 Command-Line Quickstart

An alternative way of getting a root prompt, without having to enable the root account, is to issue the command sudo -i. After entering your password, you will find yourself at a root prompt (#). Do what you need to do and when you are finished, type exit, and press Enter to return to your usual prompt. You can learn more about sudo and root from an Ubuntu perspective at https://help.ubuntu.com/community/RootSudo. Understanding the Linux File System Hierarchy

Linux has inherited from UNIX a well-planned hierarchy for organizing where things may be found. It isn’t perfect, but it is generally logical and mostly consistent, although distrib- utions do tend to make some modifications that force some thinking and adaptation when moving between, say, Fedora, Slackware, and Ubuntu. Table 10.1 shows some of the top-level directories that are part of a standard Linux distro.

TABLE 10.1 Basic Linux Directories Name Description

/ The root directory

/bin Essential commands

/boot Boot loader files, Linux kernel

/dev Device files

/etc System configuration files

/home User home directories

/lib Shared libraries, kernel modules

/lost+found Directory for recovered files (if found after a file system check)

/media Mount point for removable media, such as DVDs and floppy disks

/mnt Usual mount point for local, remote file systems

/opt Add-on software packages

/proc Kernel information, process control

/root Super user (root) home

/sbin System commands (mostly root only)

/srv Holds information relating to services that run on your system

/sys Real-time information on devices used by the kernel

/tmp Temporary files

/usr Software not essential for system operation, such as applications

/var Variable data (such as logs); spooled files Understanding the Linux File System Hierarchy 141

Knowing these directories can help you find files when you need them. This knowledge can even help you partition hard drives when you install new systems by letting you choose to put certain directories on their own distinct partition, which can be useful for things like isolating directories from one another, such as a server security case like putting a directory like /boot that doesn’t change often on its own partition and making it read-only and unchangeable without specific operations being done by a super user during a maintenance cycle. Desktop users probably won’t need to think about that, but the directory tree is still quite useful to know when you want to find the configuration file for a specific program and set some program options systemwide to affect all users. Some of the important directories in Table 10.1, such as those containing user and root commands or system configuration files, are discussed in the following sections. You may use and edit files under these directories when you use Ubuntu.

Essential Commands in /bin and /sbin

The /bin directory contains essential commands used by the system for running and booting the system. In general, only the root operator uses the commands in the /sbin directory. The software in both locations is essential to the system; they make the system what it is, and if they are changed or removed, it could cause instability or a complete system failure. Often, the commands in these two directories are statically linked, which means that the commands do not depend on software libraries residing under the /lib or /usr/lib directories. Nearly all the other applications on your system are dynamically linked, meaning that they require the use of external software libraries (also known as shared libraries) to run. This is a feature for both sets of software.

The commands in /bin and /sbin are kept stable to maintain foundational system integrity and do not need to be updated often, if at all. For the security of the system, these commands are kept in a separate location and isolated where changes are more diffi- cult and where it will be more obvious to the system administrator if unauthorized changes are attempted or made. Application software changes more frequently, and applications often use the same func- tions that other pieces of application software use. This was the genesis of shared libraries. When a security update is needed for something that is used by more than one program, it has to be updated in only one location, a specific software library. This enables easy and quick security updates that will affect several pieces of non-system-essential software at the same time by updating one shared library, contained in one file on the computer.

Configuration Files in /etc 10

System configuration files and directories reside under the /etc directory. Some major software packages, such as Apache, OpenSSH, and xinetd, have their own subdirectories in /etc filled with configuration files. Others like crontab or fstab use one file. Examples of system-related configuration files in /etc include the following:

. fstab—The file system table is a text file listing each hard drive, CD-ROM, floppy, or other storage device attached to your PC. The table indexes each device’s partition information with a place in your Linux file system (directory layout) and lists other 142 CHAPTER 10 Command-Line Quickstart

options for each device when used with Linux (see Chapter 21, “Kernel and Module Management”). Nearly all entries in fstab can be manipulated by root using the mount command.

. modprobe.d/—This folder holds all the instructions to load kernel modules that are required as part of the system startup.

. passwd—The list of users for the system, including special-purpose nonhuman users like syslog and CouchDB, along with user account information.

. sudoers—A list of users or user groups with super user access.

User Directories: /home The most important data on a non-server Linux system often resides in the user’s directo- ries, found under the /home directory. User directories are named by default according to account usernames, so on a computer where I have an account named matthew, my home directory would generally be found in /home/matthew. This can be changed, and doing so is covered for the curious in Chapter 11. Segregating the system and user data can be helpful in preventing data loss and making the process of backing up easier. For example, having user data reside on a separate file system or mounted from a remote computer on the network might help shield users from data loss in the event of a system hardware failure. For a laptop or desktop computer at home, you might place /home on a separate partition from the rest of the file system, so that if the operating system is upgraded, damaged, or reinstalled, /home would be more likely to survive the event intact.

Using the Contents of the /proc Directory to Interact with the Kernel

The content of the /proc directory is created from memory and exists only while Linux is running. This directory contains special files that either extract information from or send information to the kernel. Many Linux utilities extract information from dynamically created directories and files under this directory, also known as a virtual file system. For example, the free command obtains its information from a file named meminfo: matthew@seymour:~$ free

total used free shared buffers cached Mem: 4055680 2725684 1329996 0 188996 1551464 -/+ buffers/cache: 985224 3070456 Swap: 8787512 0 8787512

This information constantly changes as the system is used. You can get the same informa- tion by using the cat command to see the contents of the meminfo file: Understanding the Linux File System Hierarchy 143

matthew@seymour:~$ cat /proc/meminfo MemTotal: 4055680 KB MemFree: 1329692 KB Buffers: 189208 KB Cached: 1551488 KB SwapCached: 0 KB Active: 1222172 KB Inactive: 1192244 KB Active(anon): 684092 KB Inactive(anon): 16 KB Active(file): 538080 KB Inactive(file): 1192228 KB Unevictable: 48 KB Mlocked: 48 KB SwapTotal: 8787512 KB SwapFree: 8787512 KB Dirty: 136 KB Writeback: 0 KB AnonPages: 673760 KB Mapped: 202308 KB Shmem: 10396 KB Slab: 129248 KB SReclaimable: 107356 KB SUnreclaim: 21892 KB KernelStack: 2592 KB PageTables: 30108 KB NFS_Unstable: 0 KB Bounce: 0 KB WritebackTmp: 0 KB CommitLimit: 10815352 KB Committed_AS: 1553172 KB VmallocTotal: 34359738367 KB VmallocUsed: 342300 KB VmallocChunk: 34359387644 KB HardwareCorrupted: 0 KB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 10 HugePages_Surp: 0 Hugepagesize: 2048 KB DirectMap4k: 38912 KB DirectMap2M: 4153344 KB

The /proc directory can also be used to dynamically alter the behavior of a running Linux kernel by “echoing” numerical values to specific files under the /proc/sys directory. For 144 CHAPTER 10 Command-Line Quickstart

example, to “turn on” kernel protection against one type of denial-of-service (DoS) attack known as SYN flooding, use the echo command to send the number 1 to the following /proc path: matthew@seymour:~$ $ sudo echo 1 >/proc/sys/net/ipv4/tcp_syncookies

Other ways to use the /proc directory include the following:

. Getting CPU information, such as the family, type, and speed from /proc/cpuinfo.

. Viewing important networking information under /proc/net, such as active inter- faces information under /proc/net/dev, routing information in /proc/net/route, and network statistics in /proc/net/netstat. . Retrieving file system information. . Reporting media mount point information via USB; for example, the Linux kernel reports what device to use to access files (such as /dev/sda) if a USB camera or hard drive is detected on the system. You can use the dmesg command to see this information.

. Getting the kernel version in /proc/version, performance information such as uptime in /proc/uptime, or other statistics such as CPU load, swap file usage, and processes in /proc/stat.

Working with Shared Data in the /usr Directory

The /usr directory contains software applications, libraries, and other types of shared data for use by anyone on the system. Many Linux system administrators give /usr its own partition. A number of subdirectories under /usr contain manual pages (/usr/share/man), software package shared files (/usr/share/name_of_package, such as /usr/share/emacs), additional application or software package documentation (/usr/share/doc), and an entire subdirectory tree of locally built and installed software, /usr/local. Temporary File Storage in the /tmp Directory

As its name implies, the /tmp directory is used for temporary file storage; as you use Linux, various programs create files in this directory. Accessing Variable Data Files in the /var Directory

The /var directory contains subdirectories used by various system services for spooling and logging. Many of these variable data files, such as print spooler queues, are temporary, whereas others, such as system and kernel logs, are renamed and rotated in use. Incoming email is usually directed to files under /var/spool/mail.

Linux also uses /var for other important system services. These include the topmost File Transfer Protocol (FTP) directory under /var/ftp (see Chapter 25, “Remote File Serving with FTP”), and the Apache web server’s initial home page directory for the system, /var/www/html. (See Chapter 23, “Apache Web Server Management,” for more information about using Apache.) Navigating the Linux File System 145

NOTE

There is a recent trend to move data that is served from /var/www and /var/ftp to /srv, but this is not universal.

Navigating the Linux File System

In the Linux file system, as with its predecessor UNIX, everything is a file: data files, binary files, executable programs, even input, and output devices. These files are placed in a series of directories that act like file folders. A directory is nothing more than a special type of file that contains a list of other files/directories. These files and directories are used to create a hierarchical structure that enables logical placement of specific types of files. Later in this chapter, we discuss the standard hierarchy of the Linux file system. First, you learn how to navigate and interact with the file system.

NOTE A directory with contents is called a parent and its contents are called children, as in ”/home/matthew/Documents is a child directory of /home/matthew, its parent.”

Listing the Contents of a Directory with ls

The ls command lists the contents of the current directory. It is commonly used by itself, but a number of options (also known as switches) are available for ls and give you more information. If you have just logged in as described earlier, this command lists the files and directories in your user’s home directory: matthew@seymour:~$ ls Documents Music file.txt Pictures Music

NOTE All directory listings in this chapter are abbreviated to save space.

By itself, the ls command shows just a list of names. Some are files, some are directories. This is useful if I know what I am looking for but cannot remember the exact name. However, using ls in this matter has some limitations. First, it does not show hidden files. Hidden files use filenames that start with a period (.) as the first character. They are often 10 used for configuration of specific programs and are not accessed frequently. For this reason, they are not included in a basic directory listing. You can see all the hidden files by adding a switch to the command like this: matthew@seymour:~$ ls -a . .bash_logout Documents Music .. .bashrc file.txt Pictures .bash_history .config .local .profile 146 CHAPTER 10 Command-Line Quickstart

There is still more information available about each item in a directory. To include details such as the file/directory permissions, owner and group (all of which are discussed later in this chapter), as well as the size, and the date and time it was last modified, enter the following: matthew@seymour:~$ ls -al total 608 drwxr-xr-x 38 matthew matthew 4096 2011-06-04 08:20 . drwxr-xr-x 3 root root 4096 2011-05-16 16:48 .. -rw------1 matthew matthew 421 2011-06-04 10:27 .bash_history -rw-r--r-- 1 matthew matthew 220 2011-05-16 16:48 .bash_logout -rw-r--r-- 1 matthew matthew 3353 2011-05-16 16:48 .bashrc drwxr-xr-x 13 matthew matthew 4096 2011-05-21 10:42 .config drwxr-xr-x 2 matthew matthew 4096 2011-05-16 17:07 Documents -rw-r--r-- 1 matthew matthew 335 2011-05-16 16:48 file.txt drwxr-xr-x 3 matthew matthew 4096 2011-05-16 17:07 .local drwxr-xr-x 2 matthew matthew 4096 2011-05-16 17:07 Music drwxr-xr-x 3 matthew matthew 4096 2011-05-16 18:07 Pictures -rw-r--r-- 1 matthew matthew 675 2011-05-16 16:48 .profile

The listing (abbreviated here) is now given with one item per line, but with multiple columns. The listing starts with the number of items in the directory. (Both files and sub- directories are included; remember that the listing here is abbreviated.) Then, the details are as shown in Figure 10.1.

FIGURE 10.1 Decoding the output of a detailed directory listing.

These details are discussed more completely later in the chapter in the “Working with Permissions” section. Another useful switch is this: matthew@seymour:~$ ls -R

This command scans and lists all the contents of the subdirectories of the current direc- tory. This is likely to be a lot of information, so you may want to redirect the output to a text file so that you can browse through it at your leisure by using the following: matthew@seymour:~$ ls -laR > listing.txt Navigating the Linux File System 147

TIP

The previous command sends the output of ls -laR to a file called listing.txt and demonstrates part of the power of the Linux command line. At the command line, you can use files as inputs to commands, or you can generate files as outputs as shown. For more information about redirects and combining commands, see Chapter 11. In the meantime, note that you can read the contents of that text file using the command less listing.txt, which lets you read the file bit by bit using the arrow keys to navi- gate in the file (or Enter to move to the next line), the spacebar to move to the next page, and q to exit when done.

Changing Directories with cd

Use the cd command to move within the file system from one directory to another. It may help you remember this command to think of it meaning “change directory.” The most basic usage of cd is this: matthew@seymour:~$ cd somedir

That looks in the current directory for the somedir subdirectory, then moves you into it. You can also specify an exact location for a directory, like this: matthew@seymour:~$ cd /home/matthew/stuff/somedir

The cd command can also be used with several shortcuts. For example, to quickly move up to the parent directory, the one above the one you are currently in, use the cd command like this: matthew@seymour:~$ cd ..

To return to your home directory from anywhere in the Linux file system, use the cd command like this: matthew@seymour:~$ cd

You can also use the $HOME shell environment variable to accomplish the same thing. Environment variables are discussed in greater detail in Chapter 11. Type this command and press Enter to return to your home directory: matthew@seymour:~$ cd $HOME 10 You can accomplish the same thing by using the tilde (~) like this: matthew@seymour:~$ cd ~

Finding Your Current Directory with pwd

Use pwd to remind you where you are within the file system. 148 CHAPTER 10 Command-Line Quickstart

Working with Permissions

Under Linux (and UNIX), everything in the file system, including directories and devices, is a file. And every file on your system has an accompanying set of permissions based on ownership. These permissions provide data security by giving specific permission settings to every single item denoting who may read, write, or execute the file. These permissions are set individually for the file’s owner, for members of the group the file belongs to, and for all others on the system.

You can examine the default permissions for a file you create by using the umask command, which lists default permissions using the number system explained next, or by using the touch command and then the ls command’s long-format listing like this: matthew@seymour:~$ touch file matthew@seymour:~$ ls -l file -rw-r--r-- 1 matthew matthew 0 2010-06-30 13:06 file

In this example, the touch command is used to quickly create a file. The ls command then reports on the file, displaying the following (from left to right):

. The type of file created—Common indicators of the type of file are in the leading letter in the output. A blank (which is represented by a dash, as in the preceding example) designates a plain file, d designates a directory, c designates a character device (such as /dev/ttyS0), and b is used for a block device (such as /dev/sda). . Permissions—Read, write, and execute permissions for the owner, group, and all others on the system. (You learn more about these permissions later in this section.)

. Number of links to the file—The number 1 designates that there is only one file, whereas any other number indicates that there might be one or more hard-linked files. Links are created with the ln command. A hard-linked file is an exact copy of the file, but it might be located elsewhere on the system. Symbolic links of directo- ries can also be created, but only the root operator can create a hard link of a direc- tory. . The owner—The account that owns the file; this is originally the file creator, but you can change this designation using the chown command. . The group—The group of users allowed to access the file; this is originally the file creator’s main group, but you can change this designation using the chgrp command. . File size and creation/modification date—The last two elements indicate the size of the file in bytes and the date the file was created or last modified.

Assigning Permissions

Under Linux, permissions are grouped by owner, group, and others, with read, write, and execute permission assigned to each, as follows: Working with Permissions 149

Owner Group Others rwx rwx rxw

Permissions can be indicated by mnemonic or octal characters. Mnemonic characters are listed here:

. r indicates permission for an owner, member of the owner’s group, or others to open and read the file.

. w indicates permission for an owner, member of the owner’s group, or others to open and write to the file.

. x indicates permission for an owner, member of the owner’s group, or others to execute the file (or read a directory).

In the previous example for the file named file, the owner, matthew, has read and write permission. Any member of the group named matthew may only read the file. All other users may only read the file. Also note that default permissions for files created by the root operator (while using sudo or a root account) will differ because of umask settings assigned by the shell. Many users prefer to use numeric codes, based on octal (base 8) values, to represent permissions. Here’s what these values mean:

. 4 indicates read permission.

. 2 indicates write permission.

. 1 indicates execute permission.

In octal notation, the previous example file has a permission setting of 664 (read + write or 4 + 2, read + write or 4 + 2, read-only or 4). Although you can use either form of permissions notation, octal is easy to use quickly after you visualize and understand how permissions are numbered.

NOTE In Linux, you can create groups to assign a number of users access to common direc- tories and files, based on permissions. You might assign everyone in accounting to a group named accounting and allow that group access to accounts payable files while disallowing access by other departments. Defined groups are maintained by the root operator, but you can use the newgrp command to temporarily join other groups to access files (as long as the root operator has added you to the other groups). You can 10 also allow or deny other groups’ access to your files by modifying the group permis- sions of your files. 150 CHAPTER 10 Command-Line Quickstart

Directory Permissions

Directories are also files under Linux. For example, again use the ls command to show permissions like this: matthew@seymour:~$ mkdir directory matthew@seymour:~$ ls -ld directory drwxr-xr-x 2 matthew matthew 4096 2010-06-30 13:23 directory

In this example, the mkdir command is used to create a directory. The ls command, and its -ld option, is used to show the permissions and other information about the directory (not its contents). Here you can see that the directory has permission values of 755 (read + write + execute or 4 + 2 + 1, read + execute or 4 + 1, and read + execute or 4 + 1). This shows that the owner can read and write to the directory and, because of execute permission, also list the directory’s contents. Group members and all other users can list only the directory contents. Note that directories require execute permission for anyone to be able to view their contents.

You should also notice that the ls command’s output shows a leading d in the permis- sions field. This letter specifies that this file is a directory; normal files have a blank field in its place. Other files, such as those specifying a block or character device, have a differ- ent letter. For example, if you examine the device file for a Linux serial port, you will see the following: matthew@seymour:~$ ls -l /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 2010-06-30 08:13 /dev/ttyS0

Here, /dev/ttyS0 is a character device (such as a serial communications port and desig- nated by a c) owned by root and available to anyone in the dialout group. The device has permissions of 660 (read + write, read + write, no permission). On the other hand, if you examine the device file for an IDE hard drive, you see this: matthew@seymour:~$ ls -l /dev/sda brw-rw-- -- 1 root disk 8, 0 2010-06-30 08:13 /dev/sda

In this example, b designates a block device (a device that transfers and caches data in blocks) with similar permissions. Other device entries you will run across on your Linux system include symbolic links, designated by s.

Altering File Permissions with chmod

You can use the chmod command to alter a file’s permissions. This command uses various forms of command syntax, including octal or a mnemonic form (such as u, g, o, or a and rwx, and so on) to specify a desired change. The chmod command can be used to add, remove, or modify file or directory permissions to protect, hide, or open up access to a file by other users (except for the root account or a user with super-user permission and using sudo, either of which can access any file or directory on a Linux system). Working with Permissions 151

The mnemonic forms of chmod’s options are (when used with a plus character, +, to add, or a minus sign, -, to remove):

. u—Adds or removes user (owner) read, write, or execute permission.

. g—Adds or removes group read, write, or execute permission.

. o—Adds or removes read, write, or execute permission for others not in a file’s group.

. a—Adds or removes read, write, or execute permission for all users.

. r—Adds or removes read permission.

. w—Adds or removes write permission.

. x—Adds or removes execution permission.

For example, if you create a file, such as a readme.txt, the file has the following default permissions (set by the umask setting in /etc/bashrc):

-rw-r--r-- 1 matthew matthew 0 2010-06-30 13:33 readme.txt

As you can see, you can read and write the file. Anyone else can only read the file (and only if it is outside your home directory, which will have read, write, and execute permis- sion set only for you, the owner). You can remove all write permission for anyone by using chmod, the minus sign (-), and aw, as follows: matthew@seymour:~$ chmod a-w readme.txt matthew@seymour:~$ ls -l readme.txt -r--r--r-- 1 matthew matthew 0 2010-06-30 13:33 readme.txt

Now, no one can write to the file (except you, if the file is in your /home or /tmp directory because of directory permissions). To restore read and write permission for only you as the owner, use the plus sign (+) and the u and rw options like so: matthew@seymour:~$ chmod u+rw readme.txt matthew@seymour:~$ ls -l readme.txt -rw-r--r-- 1 matthew matthew 0 2010-06-30 13:33 readme.txt

You can also use the octal form of the chmod command (for example, to modify a file’s permissions so that only you, the owner, can read and write a file). Use the chmod command and a file permission of 600, like this:

matthew@seymour:~$ chmod 600 readme.txt 10 matthew@seymour:~$ ls -l readme.txt -rw------1 matthew matthew 0 2010-06-30 13:33 readme.txt

If you take away execution permission for a directory, files might be hidden inside and may not be listed or accessed by anyone else (except the root operator, of course, who has access to any file on your system). By using various combinations of permission settings, you can quickly and easily set up a more secure environment, even as a normal user in your /home directory. 152 CHAPTER 10 Command-Line Quickstart

File Permissions with chgrp

You can use the chgrp command to change the group to which a file belongs: matthew@seymour:~$ chgrp wheel filename

Changing File Permissions with chown

You can use the chown command to change the owner of a file: matthew@seymour:~$ chown matthew filename

You can also use the chown command to change the group of a file at the same time: matthew@seymour:~$ chown matthew:wheel filename

Understanding Set User ID and Set Group ID Permissions

Two more types of permission are “set user ID,” known as suid, and “set group ID,” or sgid. These settings, when used in a program, enable any user running that program to have program owner or group owner permissions for that program. These settings enable the program to be run effectively by anyone, without requiring that each user’s permissions be altered to include specific permissions for that program.

One commonly used program with suid permissions is the passwd command: matthew@seymour:~$ ls -l /usr/bin/passwd

-rwsr-xr-x 1 root root 42856 2010-01-26 10:09 /usr/bin/passwd

This setting allows normal users to execute the command (as root) to make changes to a root-only-accessible file /etc/passwd.

You also can assign similar permission with the chfn command. This command allows users to update or change finger information in /etc/passwd. You accomplish this permission modification by using a leading 4 (or the mnemonic s) in front of the three octal values.

NOTE

Other files that might have suid or guid permissions include at, rcp, rlogin, rsh, chage, chsh, ssh, crontab, sudo, sendmail, ping, mount, and several UNIX-to-UNIX Copy (UUCP) utilities. Many programs (such as games) might also have this type of per- mission to access a sound device.

Files or programs that have suid or guid permissions can sometimes present security holes because they bypass normal permissions. This problem is compounded if the permission extends to an executable binary (a command) with an inherent security flaw because it Working with Files 153

could lead to any system user or intruder gaining root access. In past exploits, this typi- cally happened when a user fed a vulnerable command with unexpected input (such as a long pathname or option); the command would fail, and the user would be presented a root prompt. Although Linux developers are constantly on the lookout for poor program- ming practices, new exploits are found all the time, and can crop up unexpectedly, espe- cially in newer software packages that haven’t had the benefit of peer developer review. Savvy Linux system administrators keep the number of suid or guid files present on a system to a minimum. The find command can be used to display all such files on your system: matthew@seymour:~$ sudo find / -type f -perm /6000 -exec ls -l {} \;

NOTE

The find command is quite helpful and can be used for many purposes, such as before or during backup operations.

Note that the programs do not necessarily have to be removed from your system. If your users really do not need to use the program, you can remove the programs execute permis- sion for anyone. You have to decide, as the root operator, whether your users are allowed, for example, to mount and unmount CD-ROMs or other media on your system. Although Linux-based operating systems can be set up to accommodate ease of use and convenience, allowing programs such as mount to be suid might not be the best security policy. Other candidates for suid permission change could include the chsh, at,orchage commands.

Working with Files

Managing files in your home directory involves using one or more easily remembered commands.

Creating a File with touch To create an empty file called filename within your current directory, use the following command: matthew@seymour:~$ touch filename 10 To edit this file, you must use a text editor. Several are discussed in Chapter 11. However, it is sometimes useful to create an empty file as this creates an access record because of the time and date information that is connected to the file. You can also use touch to update this information, called a timestamp, without otherwise accessing or modifying a file. 154 CHAPTER 10 Command-Line Quickstart

You can create a file in a different location by changing what is after touch. To create a new file in /home/matthew/randomdirectory, if I am already in my home directory, I can use the following: matthew@seymour:~$ touch randomdirectory/newfile

Or from anywhere using an absolute path, I use this: matthew@seymour:~$ touch /home/matthew/randomdirectory/newfile

Or from anywhere using a path shortcut, I use the following command: matthew@seymour:~$ touch ~/randomdirectory/newfile

Creating a Directory with mkdir To create an empty directory called newdirectory within your current directory, use this command: matthew@seymour:~$ mkdir newdirectory

You can create a directory in a different location by changing what is after mkdir. To create a new directory in /home/matthew/music, if I am already in my /home directory, I can use the following: matthew@seymour:~$ mkdir music/newdirectory

Or from anywhere using an absolute path, I can use this: matthew@seymour:~$ mkdir /home/matthew/music/newdirectory

Or from anywhere using a path shortcut, I can use the following command: matthew@seymour:~$ mkdir ~/music/newdirectory

The -p option is valuable. It allows you to create a directory and its parent directories at the same time, if they do not already exist. This can be a real time saver. If the parent directories exist, the command works normally. For example, suppose I make a new direc- tory with two layers of subdirectories. In this example, music and newdirectory already exist, but subdir1 and subdir2 are to be created: matthew@seymour:~$ mkdir -p ~/music/newdirectory/subdir1/subdir2

Deleting a Directory with rmdir

To delete an empty directory named directoryname, use the following command: matthew@seymour:~$ rmdir directoryname Working with Files 155

You can remove a directory in a different location by changing what is after rmdir. To remove a directory in /home/matthew/music, if I am already in my /home directory, I can use the following: matthew@seymour:~$ rmdir music/directoryname

Or from anywhere using an absolute path, I can use this: matthew@seymour:~$ rmdir /home/matthew/music/directoryname

Or from anywhere using a path shortcut, I can use the following command: matthew@seymour:~$ rmdir ~/music/directoryname

The directory must be empty to be removed using rmdir. However, there is a way to remove a directory with its contents using rm.

WARNING

You cannot easily recover anything that has been deleted using rmdir or rm, so pro- ceed carefully. Be absolutely certain you will never need what you are about to delete before you do so. Only a professional service is likely to be able to recover the files, and even then at great expense.

Deleting a File or Directory with rm To delete a file named filename, use this command: matthew@seymour:~$ rm filename

You can remove a directory in a different location by changing what is after rm. To remove a directory in /home/matthew/randomdirectory, if I am already in my /home directory, I can use the following: matthew@seymour:~$ rm randomdirectory/filename

Or from anywhere using an absolute path, I can use this: matthew@seymour:~$ rm /home/matthew/randomdirectory/filename

Or from anywhere using a path shortcut, I can use the following command: 10 matthew@seymour:~$ rm ~/randomdirectory/filename

If you try to use rm to remove an empty directory, you will receive an error message: rm: cannot remove `random/’: Is a directory. In this case, you must use rmdir. However, you can remove a directory and its contents using rm. 156 CHAPTER 10 Command-Line Quickstart

WARNING Here Be Dragons Be sure that all the contents of a directory are known and unwanted if you choose to delete them. There is no way to recover them later. Also, be careful that you don’t have extra spaces, mistype the name of the directory, or use sudo to delete something that you shouldn’t be deleting. Linux gives you great power, and it will let you use that power without questioning you about it; that’s the human’s job.

To delete a directory and all its contents, use the -R recursive switch. This switch works with many commands, not only rm: matthew@seymour:~$ rm -R /home/matthew/randomdirectory/

Everything in randomdirectory as well as in the directory itself will be deleted. Moving or Renaming a File with mv In Linux land, moving and renaming a file are the same thing. It doesn’t matter whether you are moving the directory to another or from one filename to another filename in the same directory, there is only one command to remember. To move a file named filename from ~/documents to ~/archive, use this command: matthew@seymour:~$ mv documents/filename archive

Notice that the filename is not included in the destination. The destination here must be an existing directory. If it is not, the file is renamed to the term used. Some examples will make this clear. To rename a file that is in my current directory, I could use the following: matthew@seymour:~$ mv oldfilename newfilename

To rename a file as I move it from ~/documents to ~/archive, I could use this: matthew@seymour:~$ mv documents/oldfilename archive/newfilename

Or from anywhere using an absolute path, I could use the following command: matthew@seymour:~$ mv /home/matthew/documents/oldfilename /home/matthew/archive/newfilename

Or from anywhere using a path shortcut, I could use this: matthew@seymour:~$ rm ~/documents/oldfilename ~/archive/newfilename Working with Files 157

Copying a File with cp Copying works similarly to moving, but retains the original in the original location. To copy a file named filename from ~/documents to ~/archive, use this command: matthew@seymour:~$ cp documents/filename archive

Notice that the filename is not included in the destination. The destination here must be an existing directory. If it is not, the file is renamed to the term used. Some examples will make this clear. To copy a file that is in my current directory, I could use the following, and it will work exactly the same as mv, except that both files will exist afterward: matthew@seymour:~$ cp oldfilename newfilename

To rename a file as I copy it from ~/documents to ~/archive, I could use this: matthew@seymour:~$ cp documents/oldfilename archive/newfilename

Or from anywhere using an absolute path, I could use the following command: matthew@seymour:~$ cp /home/matthew/documents/oldfilename /home/matthew/archive/newfilename

Or from anywhere using a path shortcut, I can use this: matthew@seymour:~$ cp ~/documents/oldfilename ~/archive/newfilename

Displaying the Contents of a File with cat

To view the contents of a text file named filename on your screen, use this command: matthew@seymour:~$ cat filename

Notice that the text is displayed on your screen but that you cannot edit or work with the text in any way. This command is convenient when you want to know the contents of a file but don’t need to make any changes. Text editors for the terminal are covered in Chapter 11. This command works best with short files because the contents of longer files will scroll off of the screen too quickly to be read. 10 Displaying the Contents of a File with less When you need to view the contents of a longer text file from the command line, you can use less. This produces a paged output, meaning that output stops each time your screen is full. You can then use your up- and down-arrow keys and page-up and 158 CHAPTER 10 Command-Line Quickstart

page-down keys to scroll through the contents of the file. Then, use q to quit and return to the command line: matthew@seymour:~$ less filename

There was a program that did give paged output in the early days of UNIX called more. It was the first paged output program but did not include the ability to scroll up and down. less was written to add that capability and was named as a bit of hacker humor, because “less is more.” You can also use more, but today it is merely an alias for less.

Using Wildcards and Regular Expressions

Each of these commands can be used with pattern-matching strings known as wildcards or regular expressions. For example, to delete all files in the current directory beginning with the letters abc, you can use an expression beginning with the first three letters of the desired filenames. An asterisk (*) is then appended to match all these files. Use a command line with the rm command like this: matthew@seymour:~$ rm abc*

Linux shells recognize many types of file naming wildcards, but this is different from the capabilities of Linux commands supporting the use of more complex expressions. You learn more about using wildcards in Chapter 11, “Command-Line Master Class,” and in Chapter 13, “Automating Tasks and Shell Scripting.”

NOTE

You can also learn more about using expressions by reading the grep manual pages (man grep), but because both man and grep are covered in Chapter 11, consider this mention as included only to whet your appetite.

Working as Root

The root, or super user account, is a special account and user on UNIX and Linux systems. Super-user permissions are required in part because of the restrictive file permissions assigned to important system configuration files. You must have root permission to edit these files or to access or modify certain devices (such as hard drives). When logged in as root, you have total control over your system, which can be dangerous. When you work in root, you can destroy a running system with a simple invocation of the rm command, like this: matthew@seymour:~$ sudo rm -rf /

This command line not only deletes files and directories, but also could wipe out file systems on other partitions and even remote computers. This alone is reason enough to take precautions when using root access. Working as Root 159

The only time you should run Linux as the super user is when you are configuring the file system, for example, or to repair or maintain the system. Logging in and using Linux as the root operator isn’t a good idea because it defeats the entire concept of file permissions. Knowing how to run commands as the super user (root) without logging in as root can help avoid serious missteps when configuring your system. In Ubuntu, you can use sudo to allow you to execute single commands as root and then quickly return to normal user status. For example, if you would like to edit your system’s file system table (a simple text file that describes local or remote storage devices, their type, and location), you can use sudo like this: matthew@seymour:~$ sudo nano -w /etc/fstab Password:

After you press Enter, you are prompted for a password that gives you access to root. This extra step can also help you “think before you leap” into the command. Enter the root password, and you are then editing /etc/fstab, using the nano editor with line wrapping disabled (thanks to the -w).

CAUTION Before editing any important system or software service configuration file, make a backup copy. Then make sure to launch your text editor with line wrapping disabled. If you edit a configuration file without disabling line wrapping, you could insert spurious carriage returns and line feeds into its contents, causing the configured service to fail when restarting. By convention, nearly all configuration files are formatted for 80-char- acter text width, but this is not always the case. By default, the vi and emacs editors don’t use line wrap.

Creating Users

When a Linux system administrator creates a user, an entry in /etc/passwd for the user is created. The system also creates a directory, labeled with the user’s username, in the /home directory. For example, if you create a user named heather, the user’s home directory is /home/heather.

NOTE In this chapter, you learn how to manage users from the command line. See Chapter

12, “Managing Users,” for more information on user administration, including doing so 10 using graphical administration utilities.

Use the useradd command, along with a user’s name, to quickly create a user: matthew@seymour:~$ sudo useradd heather 160 CHAPTER 10 Command-Line Quickstart

After creating the user, you must also create the user’s initial password with the passwd command: matthew@seymour:~$ sudo passwd heather

Changing password for user heather. New password: Retype new password: passwd: all authentication tokens updated successfully.

Enter the new password twice. If you do not create an initial password for a new user, the user cannot log in.

You can view useradd’s default new user settings by using the command and its -D option, like this: matthew@seymour:~$ useradd -D GROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/sh SKEL=/etc/skel CREATE_MAIL_SPOOL=no

These options display the default group ID, home directory, account and password policy (active forever with no password expiration), the default shell, and the directory contain- ing defaults for the shell.

The useradd command has many command-line options. The command can be used to set policies and dates for the new user’s password, assign a login shell, assign group membership, and other aspects of a user’s account. See man useradd for more info.

Deleting Users

Use the userdel command to delete users from your system. This command removes a user’s entry in the system’s /etc/passwd file. You should also use the command’s -r option to remove all the user’s files and directories (such as the user’s mail spool file under /var/spool/mail): matthew@seymour:~$ sudo userdel -r andrew

If you do not use the -r option, you have to manually delete the user’s directory under /home, along with the user’s /var/spool/mail queue. Working as Root 161

Shutting Down the System

Use the shutdown command to shut down your system. The shutdown command has a number of different command-line options (such as shutting down at a predetermined time), but the fastest way to cleanly shut down Linux is to use the -h or halt option, followed by the word now or the numeral zero (0), like this: matthew@seymour:~$ sudo shutdown -h now or matthew@seymour:~$ sudo shutdown -h 0

To incorporate a timed shutdown and a pertinent message to all active users, use shutdown’s time and message options, as follows: matthew@seymour:~$ sudo shutdown -h 18:30 “System is going down for maintenance this evening at 6:30 p.m. Please make sure you have saved your work and logged out by then or you may lose data.”

This example shuts down your system and provides a warning to all active users 15 minutes before the shutdown (or reboot). Shutting down a running server can be consid- ered drastic, especially if there are active users or exchanges of important data occurring (such as a backup in progress). One good approach is to warn users ahead of time. This can be done by editing the system Message of the Day (MOTD) motd file, which displays a message to users when they login using the command-line interface, as is common on multi-user systems. It used to be that to create a custom MOTD, you only had to use a text editor and change the contents of /etc/motd. However, this has changed in Ubuntu as the developers have added a way to automatically and regularly update some useful information contained in MOTD using cron. To modify how the MOTD is updated, you should install update-motd and read the man page. You can also make downtimes part of a regular schedule, perhaps to coincide with security audits, software updates, or hardware maintenance. You should shut down Ubuntu for only a few very specific reasons:

. You are not using the computer, no other users are logged in or expected to need or use the system (such as your personal desktop or laptop computer), and you want to

conserve electrical power. 10 . You need to perform system maintenance that requires any or all system services to be stopped. . You want to replace integral hardware. 162 CHAPTER 10 Command-Line Quickstart

TIP Do not shut down your computer if you suspect that intruders have infiltrated your sys- tem; instead, disconnect the machine from any or all networks and make a backup copy of your hard drives. You might want to also keep the machine running to examine the contents of memory and to examine system logs. Exceptions to this are when the system contains only trivial data files and nonessential services, such as a personal computer that is only used to run a web browser, and when you have no intention of trying to track down what an intruder may have changed, either to repair the damage or to try to catch them using computer forensics, but rather plan to merely wipe every- thing clean and rebuild or reinstall the system from scratch.

Rebooting the System

You should also use the shutdown command to reboot your system. The fastest way to cleanly reboot Linux is to use the -r option, and the word now or the numeral zero (0): matthew@seymour:~$ sudo shutdown -r now or matthew@seymour:~$ sudo shutdown -r 0

Both rebooting and shutting down can have dire consequences if performed at the wrong time (such as during backups or critical file transfers, which arouses the ire of your system’s users). However, Linux-based operating systems are designed to properly stop active system services in an orderly fashion. Other commands you can use to shut down and reboot Linux are the halt and reboot commands, but the shutdown command is more flexible. Reading Documentation

Although you learn the basics of using Ubuntu in this book, you need time and practice to master and troubleshoot more complex aspects of the Linux operating system and your distribution. As with any operating system, you can expect to encounter some problems or perplexing questions as you continue to work with Linux. The first place to turn for help with these issues is the documentation included with your system; if you cannot find the information you need there, check Ubuntu’s website. Using apropros Linux, like UNIX, is a self-documenting system, with man pages accessible through the man command. Linux offers many other helpful commands for accessing its documenta- tion. You can use the apropos command (for example, with a keyword such as partition) to find commands related to partitioning, like this: Reading Documentation 163

matthew@seymour:~$ apropos partition addpart (8) - Simple wrapper around the “add partition” ioctl all-swaps (7) - Event signaling that all swap partitions have been ac... cfdisk (8) - Curses/slang based disk partition table manipulator fo... delpart (8) - Simple wrapper around the “del partition” ioctl fdisk (8) - Partition table manipulator for Linux gparted (8) - Gnome partition editor for manipulating disk partitions. Mpartition (1) - Partition an MSDOS hard disk Partprobe (8) - Inform the OS of partition table changes Partx (8) - Telling the kernel about presence and numbering of on-... Pvcreate (8) - Initialize a disk or partition for use by LVM Pvresize (8) - Resize a disk or partition in use by LVM2 Sfdisk (8) - Partition table manipulator for Linux

To find a command and its documentation, you can use the whereis command. For example, if you are looking for the fdisk command, you can do this:

$ whereis fdisk fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz

Using Man Pages

To learn more about a command or program, use the man command followed by the name of the command. Man pages are stored in places like /usr/share/man and /usr/local/share/man, but you don’t need to know that. To read a man page, such as the one for the rm command, use the man command like this: matthew@seymour:~$ man rm

After you press Enter, the less command (a Linux command known as a pager) displays the man page. The less command is a text browser you can use to scroll forward and backward (even sideways) through the document to learn more about the command. Type the letter h to get help, use the forward slash (/) to enter a search string, or press q to quit.

NOTE Nearly all the hundreds of commands included with Linux each have a man page; however, some do not or may only have simple pages. You may also use the info command to read more detailed information about some commands or as a replace-

ment for others. For example, to learn even more about info (which has a rather exten- 10 sive manual page), use the info command, like this: $ info info

Use the arrow keys to navigate through the document and press q to quit reading.

The following programs and built-in shell commands are commonly used when working at the command line. These commands are organized by category to help you understand 164 CHAPTER 10 Command-Line Quickstart

the command’s purpose. If you need to find full information for using the command, you can find that information under the command’s man page.

. Managing users and groups—chage, chfn, chsh, edquota, gpasswd, groupadd, groupdel, groupmod, groups, mkpasswd, newgrp, newusers, passwd, umask, useradd, userdel, usermod

. Managing files and file systems—cat, cd, chattr, chmod, chown, compress, cp, dd, fdisk, find, gzip, ln, mkdir, mksfs, mount, mv, rm, rmdir, rpm, sort, swapon, swapoff, tar, touch, umount, uncompress, uniq, unzip, zip

. Managing running programs—bg, fg, kill, killall, nice, ps, pstree, renice, top, watch

. Getting information—apropos, cal, cat, cmp, date, diff, df, dir, dmesg, du, env, file, free, grep, head, info, last, less, locate, ls, lsattr, man, more, pinfo, ps, pwd, stat, strings, tac, tail, top, uname, uptime, vdir, vmstat, w, wc, whatis, whereis, which, who, whoami

. Console text editors—ed, jed, joe, mcedit, nano, red, sed, vim

. Console Internet and network commands—bing, elm, ftp, host, hostname, ifconfig, links, lynx, mail, mutt, ncftp, netconfig, netstat, pine, ping, pump, rdate, route, scp, sftp, ssh, tcpdump, traceroute, whois, wire-test

References

. https://help.ubuntu.com/community/UsingTheTerminal—The Ubuntu commu- nity help page for using the terminal. . https://help.ubuntu.com/community/LinuxFilesystemTreeOverview—The Ubuntu community help page for and overview of the Linux file system tree. . https://help.ubuntu.com/community/RootSudo—An Ubuntu community page explaining sudo, the philosophy behind using it by default, and how to use it. Index

Symbols

/ (backslash), 254 ` (backtick), 255 ” (double quotes), 253 ’ (single quotes), 254 10BASE-T, 340 64-bit Ubuntu, 773 100BASE-T, 340 802.11 standard, 363-364 1000BASE-T, 340

A

AbiWord (GNOME Office), 72 ac command, 228 access control, 469-474 ACID compliance, 542 ACLs (access control lists), 523-527, 528-529 Ada, 750 Adblock Plus plug-in, 55 address-based virtual hosts, 480 administration boot process, administrative tools used to control services at, 280 LDAP (Lightweight Directory Access Protocol), 572-574 Adobe Flash plug-in, 98 Advanced Package Tool (APT), 123-127 788 aliases, forwarding an email with

aliases, forwarding an email with, 510-511 performance tuning, 405-406 all-in-one (print/fax/scan) devices, 453 quick guide to, 460 allow directive, 470-471 runtime server configuration settings, AllowOverrides directive, 469 463-469 Alpine, 60 source code, building, 458-460 ALSA (Advanced Linux Sound Architecture), 78 starting/stopping, 461-463 Alternate install CD, 8 virtual hosting, 480-482 Amanda, 310, 318-319 apache2.conf file, 464-467 AMD, 110 AppArmor, 392-395 Android, 759-764 Apple Disk Utility, 9 Application Framework, 761 Application Framework, 761 applications, 761 applications creating your first, 764-765 Android, 761, 764-765 Eclipse installation, 761-762 GNOME Office, 72 hardware, 760 apropos command, 162-163 Java installation, 761 APT (Advanced Package Tool), 123-127 libraries, 760 apt-get utility, 23-25 Linux kernel, 760 aptitude command, 25 SDK (software development kit) ARAPNET, 53 installation, 761-764 arithmetic operators, 655-656 virtual devices installation, 763-764 arrays Android Runtime, 760 Perl, 653 Android Virtual Device (AVD), 763-764 PHP, 674-676 anonymous access, controlling, 497-498 at command, 232-234 anonymous FTP servers, 492 atime, disabling, 403 Apache Tomcat, 490 authentication Apache web server, 455-456 Apache web server, 471-473 access control, 469-474 FTP servers, 492 authentication, 471-473 autoconf utility, 729-730 directories, 459-460 automating tasks, 231-236 file system authentication, 469-474 simple script used for, 249-251 .htaccess configuration files, 467-469 autoresponders, 516 installing, 457-460 AVD (Android Virtual Device), 763-764 logging, 482-483 AVI file format, 97 modules, 474-480 multiprocessing modules, 467 BIOS (basic input/output system) 789

B tar tool, 310-312 Unison, 317-318 Babbage, Charles, 750 strategy for Back In Time, 315-316 choosing, 301-304, 307 / (backslash), 254 evaluating, 305-307 ` (backtick), 255 full backup on periodic basis, 306 backups, 308 full backups with incremental backups, assessing your backup needs and 307 resources, 303-304 mirroring data, 307 copying files, 319 RAID arrays, 307 with cp command, 321 simple, 306 with Midnight Commander, 321-322 system rescue, 326 with rsync, 322-323 GRUB2 boot loader, restoring, 326-327 with tar command, 319-320 nonbooting hard drive, saving files data loss, reasons for, 302-303 from, 327 directories, 320 Ubuntu rescue disc, 326 freeware, 319 version control for configuration files, 323-326 guidelines for, 304 badblocks command, 403 hardware and media, 308 .bak extension, 20 CD-RW drives, 308-309 Banshee, 83 cloud storage, 310 Base (LibreOffice), 70 DVD+RW/-RW drives, 308-309 BaseX, 563 network storage, 309 bash shell, 237 removable storage media, 308 basic commands, 167-187 tape drive, 309 batch command, 232-234 for home user, 305 Battle for Wesnoth, 114 before installation, 11 Bazaar, 625-626 for large enterprise, 305 Behlendorf, Brian, 456 levels, 306 Berkeley DB, 560 for small office, 305 Berners-Lee, Tim, 53 software, 310 BigTable, 565 Amanda, 310, 318-319 Bikeshed, 638-640 Back In Time, 315-316 /bin directory, 140-141 Déjà Dup, 313-316 BIOS (basic input/output system), 276-277 GNOME File Roller, 312-313 performance tuning, 400-401 KDE ark, 313

How can we make this index more useful? Email us at [email protected] 790 BMP file format

BMP file format, 88 capturing screen images, 89-90 /boot directory, 140 case statement, 271-273 boot process, 275 Cassandra, 560-561 administrative tools used to control cat command, 157, 167-169 services at boot, 280 C/C++ programming language, 725-726 BIOS (basic input/output system), 276-277 GNOME client, 733-734 init process, 279-280 GNU C compiler (gcc), 732 kernel, 277-278 graphical development tools, 732-734 manually starting and stoppin KDevelop client, 732-733 services, 283 and Linux, 725-727 MBR (Master Boot Record), 277 project management tools, 727-731 runlevels, 278-283 autoconf utility, 729-730 running services at boot, 276 debugging tools, 730-731 Upstart, 283-284 macros, 728-729 bootmail tool, 641 make command, 727-729 Brasero, 91-92 makefiles, 728-729 break statement, 273, 687 reasons for using, 726 bridged networking, 587 cd command, 147, 167-171 bridges, 343 cdrecord command, 93 broadcasting, 339 CD-RW drives, 308-309 bsdftpd-ssl server, 493 CDs Bug Squad, 645 burning, 90 built-in variables, 246, 251 capacity, 93 BulletProofX, 30, 38 creating, 91-96 bunzip2 command, 199 installation from, 11 business use of Ubuntu, 771-772 playing, 81-83 buying sound and music, 84 ripping, 81-83 Bynari, 518 Cedega, 117 byobu command, 200-201 certification, Linux, 780 bzip2 command, 199 change command, 228 Chef, 131 Cherokee, 488-489 C chfn command, 228 chgrp command, 152, 206, 228 C# compiler (Mono), 738-739 child directory, 145 C# programs, structure of, 741-745 children, games for, 116 Calc (LibreOffice), 68 chmod command, 167, 171, 206, 229 command line 791

chown command, 152, 206, 229 compressed files, 199 chpasswd command, 229 directories chsh command, 212, 229 changing, 169-171 class inheritance (Python), 721-722 creating, 183 class variables (Python), 719-720 deleting, 184-185 classes, network, 333-335 listing files in current, 180-182 classic games, 110 disk usage, printing, 172-173 Claws, 60 documentation, reading, 162-164 client configuration DVDs, creating, 94-96 LDAP (Lightweight Directory Access environment variables, 191-194 Protocol), 572-573 essential command, 144 NFS (Network File System), 436-437 /etc directory, 141-142 Squid, 522 file system, navigating, 145-147 client IP addresses in Squid, 527-528 files Clojure, 750-751 copying, 171-172 Clonezilla, 11 deleting, 184-185 cloud computing, 593 finding, 173-175 advantages of, 595 linking, 178-180 Ubuntu Cloud, 593 managing, 153-158 deploying, 596-601 moving, 183 Ecua2ools, 597, 601-603 printing contents of, 168-169 and Eucalyptus, 595-603 printing last lines of, 185 Juju, managing and monitoring with, 619 /home directory, 142 Landscape, managing and monitoring index, finding files in, 180 with, 619 location of command, printing, 187 and OpenStack, 603-619 logging in, 136-138 Orchestra, deployment with, 620 logging out, 137 cloud storage, 66, 310 man pages, reading, 182-183 coaxial cable, 341 MS-DOS compared, 135 COBOL (Common Business Oriented Language), 751-752 multiple terminals, using, 200-201 code examples (Perl), 664-669 network interface configuration, 346-351 command line, 133-135 output and input, redirecting, 187-189 accessing, 135-136 paging through output, 176-178 basic commands, 167-187 password, 136 /bin directory, 141 permissions, 148-153 CDs, creating, 92-93 changing, 171 combining commands, 189-191 /proc directory, 142-144

How can we make this index more useful? Email us at [email protected] 792 command line

processes, listing, 184 chpasswd, 229 reasons for using, 166-167 chsh, 212, 229 remote computer access, 137-138 combining, 189-191 resource usage, printing, 186-187 cp (copy), 20, 157, 167, 171-172, 321 /sbin directory, 141 createdb, 556 shells, 237-239 createuser, 556 software management from, 123-128 cron, 234-236 software updates, checking for, 22-25 databases, 556 string searches, 175-176 date, 31 super user (root) account, 158-162 dmesg, 20 text editors, 194-199 dropdb, 556 text-based console login, 136-137 dropuser, 556 /tmp directory, 144 du, 167, 172-173 user accounts, 138-140 e2fsck, 403 /usr directory, 144 emacs, 167 /var directory, 144-145 find, 167, 173-175 command-line error, 651 for firewalls, 390-391 command-line processing (Perl), 668-669 free, 290 commands gcc, 167 ac, 228 gpasswd, 209 apropos, 162-163 gprof, 731 aptitude, 25 grep, 167, 175-176 at, 232-234 groupadd, 209 badblocks, 403 groupdel, 209 basic s, 167-187 groupmod, 209 batch, 232-234 groups, 229 bunzip2, 199 grpck, 209 byobu, 200-201 gunzip, 199 bzip2, 199 gzip, 199 cat, 157, 167-169 hdparm, 401-402 cd, 147, 167-171 hwclock, 32 cdrecord, 93 ifconfig, 346-349 change, 228 insmod, 416 chfn, 228 kill, 287-288 chgrp, 152, 206, 228 less, 20, 158, 167, 176-178 chmod, 167, 171, 206, 229 ln, 167, 178-180 chown, 152, 206, 229 locate, 167, 180 comparison of expressions 793

logname, 229 sysctl, 404 ls, 145-148, 167, 180-182 tail, 168, 185 lsmod, 416 tar, 199, 319-320 make, 167, 727-729 testparm, 442 man, 167, 182-183 top, 168, 186-187 mkdir, 154, 168, 183 touch, 148, 153-154 mkisofs, 92-93 tune2fs, 402-403 modprobe, 345-346, 417 user management, 228-229 mv, 156, 168, 183 useradd, 210-211, 229 mysql, 556 userdel, 211 mysqladmin, 556 usermod, 212, 229 mysqldump, 556 vim, 168 networking, 370 whereis, 163 OpenStack, 618 which, 168, 187 passwd, 211, 229 xargs, 168 Perl (Practical Extraction and Report comments (PHP), 677 Language), 669 commercial games, 116 printer sharing, 454 commercial support, 780 ps, 168, 184 Common UNIX Printing System (CUPs), 448-449 psql, 556 CommuniGate Pro, 517 pwd, 137, 147 community teams, 643-645 rm, 155-156, 168, 184-185 comparison of expressions, 255 rmdir, 154-155 file operators rmmod, 417 bash shell, 258-259 route, 349-350 pdksh shell, 258-259 scp, 376 tcsh shell, 262-263 screen, 200 logical operators sftp, 377 bash shell, 259-260 shutdown, 18 pdksh shell, 259-260 smbclient, 443 tcsh shell, 263-264 smbstatus, 442-443 number comparison splint, 730-731 bash shell, 257-258 ssh, 168 pdksh shell, 257-258 ssh-keygen, 377-379 tcsh shell, 261-262 su, 222-224, 229 shells, 255-264 sudo, 21, 139-140, 205, 224-226, 229 string comparison sync, 402 bash shell, 255-257

How can we make this index more useful? Email us at [email protected] 794 comparison of expressions

pdksh shell, 255-257 kill command, 287-288 tcsh shell, 260-261 memory, displaying free and used, 290 comparison operators, 654-655 priority scheduling and control, 288-290 compiling constants (PHP), 676 kernel, 422-430 constructors and destructors (Python), 720-721 software copying files, 157, 319 from software repositories, 129-130 with cp command, 321 from source, 128-130 with Midnight Commander, 321-322 CompizConfig Settings Manager, 51 with rsync, 322-323 compound operators, 655 with tar command, 319-320 compressed files, 199 CouchDB, 563 Compute Infrastructure (OpenStack), 603-604 cp (copy) command, 20, 157, 167, computer attacks, 384-385 171-172, 321 conditional statements CPAN (Comprehensive Perl Archive Network), 663, 665-666 Perl (Practical Extraction and Report Language), 657-658 crackers, 384 PHP, 681-682 createdb command, 556 Python, 715-717 createuser command, 556 configuration cron command, 234-236 DHCP (Dynamic Host Configuration Crossover Games, 117 Protocol), 357-358 CrossOver Office, 76 Fetchmail, 511-514 cross-platform development (Linux), 770 Internet connections, 364-365 CUPs (Common UNIX Printing System), kernel, 425-429 448-452 MySQL, 543-546 current directory, finding, 147 networks, 346 command line network interface configuration, 346-351 D files, 351-353 graphical configuration tools, 354-355 Dash, 21, 46-49 Postfix, 506-508 data directory for PostgreSQL, initializing, 547 PostgreSQL, 546-549 data locking, 541 Samba, 444-448 data loss, reasons for, 302-303 Unity, 50 database administrator (DBA), 531-532 Conky, 294-298 database clients, 550 console-based monitoring, 285-287 graphical clients, 555 disk quotas, 291 local GUI client access to a database, 552 disk space, displaying free and used, 291 MySQL command-line client, 553-554 desktop resolution 795

PostgreSQL command-line client, 555 creating database in, 547-548 SSH access to a database, 550-551 data directory, initializing, 547 Web access to a database, 552-553 data locking, 541 databases, 532-533. See also SQL privileges, granting and revoking, 549 commands for, 556 procedural language, 543 flat file, 532-533 speed, 540-541 MySQL, 540 SQL subqueries, 542 ACID compliance, 542 triggers, 543 configuring, 543-546 users, creating, 548 creating database in, 544-546 users, deleting, 548-549 data locking, 541 relational, 533 procedural language, 543 how it works, 533-535 root user, setting password for, 544 retrieving data from, 538-540 speed, 540-541 tables SQL subqueries, 542 creating, 536-537 triggers, 543 data, inserting, 537-538 NoSQL, 533, 557-559 date and time advantages of, 558 setting, 31 BaseX, 563 with date command, 31 Berkeley DB, 560 with hwclock command, 32 BigTable, 565 with Time & Date GUI, 31-32 Cassandra, 560-561 date command, 31 CouchDB, 563 DBA (database administrator), 531-532 disadvantages of, 558-559 Debian, 26, 770 document stores, 562-563 debugging tools, 730-731 HBase, 565 Déjà Dup, 313-316 key/value stores, 559-561 deleting Memcached, 561 files, 155 MemcacheDB, 561 software, 121 MongoDB, 563 Dent, Kyle, 508 Redis, 561 deny directive, 470-471 wide column stores, 563-565 deploying Ubuntu Cloud, 596-597 PHP, 700-702 private deployment, 596-601 PostgreSQL, 540 public deployment, 596-598 ACID compliance, 542 Desktop CD, installation from, 8 configuring, 546-549 desktop resolution, 43

How can we make this index more useful? Email us at [email protected] 796 desktops

desktops, 102 deleting, 154-156, 184-185 environment, 102 /dev, 140 GNOME, 106-107 /etc, 140-142 KDE, 102-104 /home, 140-142 Kubuntu, 103-104 /lib, 140 Linux on, 769 listing files in current, 180-182 Lubuntu, 106 /lost+found, 140 LXDE, 105-106 /media, 140 Unity, 45 /mnt, 140 Xfce, 104-105 /opt, 140 Xubuntu, 105 parent, 145 /dev directory, 140 permissions, 150 devices, security, 389 populating, 570-572 DevOps, 594 /proc, 140, 142-144 DHCP (Dynamic Host Configuration /root, 140 Protocol), 355 /sbin, 140-141 activating, 356-357 /srv, 140 configuration, 357-358 /sys, 140 how it works, 355-356 /tmp, 140, 144 installation, 357-358 /usr, 140, 144 network hosts, configuring, 359-361 /var, 140, 144-145 DHCP Handbook, 361 disaster recovery plan, 395-396 Dia (LibreOffice), 70 disk quotas, 227 dial-up Internet access, 368-369 console-based monitoring, 291 dictionaries (Python), 714-715 implementing, 227-228 digital cameras, 90-91 manually configuring quotas, 228 digital subscriber line (DSL), 366-368 disk space, displaying free and used, 291 directories, 140-141 disk usage, printing, 172-173 Apache web server, 459-460 display manager (X Window System), 44 backups, 320 distribution version (Linux), 768 /bin, 140-141 dmesg command, 20 /boot, 140 DocBook files, 75 changing, 147, 169-171 Document Foundation, 71 child, 145 document stores, 562-563 contents of, listing, 145-147 documentation, 162 creating, 154, 183 apropos command, 162-163 current directory, finding, 147 Linux, 773-775, 780 email clients 797

man pages, 163-164 email shells, 237 Fetchmail, 511 Ubuntu, 773-775 configuring, 511-514 assisting with, 775 global options, 512 dotdee, 131-132 installing, 511 ” (double quotes), 253 mail server options, 512-513 do...while loop, 687 user accounts, 513-514 Draw (LibreOffice), 70 how it works, 501-502 drivers, installing additional, 28-29 MDA (mail delivery agent), 503-505 dropdb command, 556 autoresponders, 516 dropuser command, 556 choosing, 515-516 DSL (digital subscriber line), 366-368 Procmail, 515 du command, 167, 172-173 Spamassassin, 515-516 dual-boot system, 10-11 Squirrelmail, 516 DVD+RW/-RW drives, 308-309 virus scanners, 516 DVDs Microsoft Exchange Server, alternatives to, burning, 90 517-518 creating, 91-96 MTA (mail transfer agents), 502 formats, 94 choosing, 503 installation from, 8, 11 Exim, 503 packet writing, 95-96 Postfix, 503 session writing, 94-95 Qmail, 503 Dynamic Host Configuration Protocol. See DHCP Sendmail, 502-503 MUA (mail user agent), 505 Postfix aliases, forwarding an email with, E 510-511 configuring, 506-508 Eclipse installation (Android), 761-762 delivery intervals, setting message, 509 Ecua2ools, 597, 601-603 installing, 506 editing video, 99-100 mail relaying, 510 Edubuntu, 576 masquerading, 508 e2fsck command, 403 smart hosts, 509 802.11 standard, 363-364 email clients, 57 emacs command, 167 Alpine, 60 emacs text editor, 194, 197-199 choosing, 57-60 Claws, 60

How can we make this index more useful? Email us at [email protected] 798 email clients

Evolution, 57-58 configuring, 511-514 Kmail, 60 global options, 512 Mutt, 60 installing, 511 Thunderbird, 59 mail server options, 512-513 Empathy, 61 user accounts, 513-514 emulators, 110 fiber optics, 340 endless loops, 267 fiber-optic cable, 342 enterprise server monitoring, 299 file management environment, desktop, 102 contents of file, displaying, 157-158 environment variables, 191-194 copying files, 157 in shell program, 246 creating files, 153-154 Erlang, 752 deleting files, 155 error checking in C#, 744-745 directories escape sequences (PHP), 678 creating, 154 /etc directory, 140-142 deleting, 154-156 /etc/host.conf file, 353 moving files, 156 /etc/hosts file, 351-352 regular expressions, 158 /etc/modprobe.conf file, 344-345 renaming files, 156 /etc/nsswitch.conf file, 352-353 wildcards, 158 /etc/passwd file, 217-218 file operators /etc/resolv.conf file, 353 bash shell, 258-259 /etc/services file, 352 pdksh shell, 258-259 ethereal, 299 tcsh shell, 262-263 Evince, 73 file permissions, 206-207 Evolution, 57-58, 72, 572-573 file sharing, 433 Exim, 503 NFS (Network File System), 434 exit function, 696 client configuration, 436-437 exit statement, 273 installing, 434 expressions, comparison of. See comparison of server configuration, 434-436 expressions starting, 434 stopping, 434 Samba, 437-438 F configuring, 444-448 global behavior, setting, 440 FDDI (fiber distributed data interface) home directories, sharing, 440-441 networks, 340 installation, 437-438 Fetchmail, 511 functions 799

manually configuring, 438-441 free command, 290 mounting Samba shares, 443-444 freeware for backups, 319 printers, sharing, 441 Freidl, Jeffrey E. F., 239 testing, 442 Freshmeat, 319 file system authentication (Apache web server), Frets on Fire, 116 469-474 Frozen Bubble, 113 file system tuning, 402-403 FTP (File Transfer Protocol), 491 files allowing/denying connection, 499-500 atime, disabling, 403 anonymous access, controlling, 497-498 copying, 171-172 anonymous FTP servers, 492 deleting, 184-185 authenticated FTP servers, 492 finding, 173-175 bsdftpd-ssl server, 493 linking, 178-180 NcFTPd server, 492-493 moving, 183 ProFTPD server, 493 network configuration, 351-353 server printing contents of, 168-169 choosing, 491-493 printing last lines of, 185 setup, 495 find command, 167, 173-175 shadow password system, 494-495 finding software installation, 493-494 programs and files, 21 users, 494-496 software, 127-128 vsftpd server, 492 Firefox, 54-55 configuring, 496-499 firewalls, 390-393 wu-ftp server, 493 first update, 16 ftphosts file, 499-500 FLAC file format, 80 full backups, 311 Flash, enabling, 55 with incremental backups, 307 flat file databases, 532-533 on periodic basis, 306 flavors (variants) of Ubuntu, 9 fully qualified domain name (FQDN), 568 FLV file format, 97 functions for loop, 659, 686 PHP, 696-699 for statement, 264-266 arrays, 692-693 foreach loop, 659, 686-687 files, 694-695 Forth, 752-753 strings, 688-691 Fortran, 753 Python, 717-718 FQDN (fully qualified domain name), 568 shell scripts, 273-274

How can we make this index more useful? Email us at [email protected] 800 games

G GIMP,72 Gnumeric, 72 games, 109 gnome-nettool, 298 Battle for Wesnoth, 114 GNU C compiler (gcc), 732 for children, 116 GNU General Public License (GPL), 767-768 classic, 110 Google BigTable, 565 commercial, 116 Google Chrome, 55-56 emulators, 110 Google Chromium, 56-57 Frets on Fire, 116 gpasswd command, 209 Frozen Bubble, 113 gprof command, 731 installing, 112-116 Graber, Stéphane, 640 proprietary video drivers for, installing, graphical clients, 555 110-111 graphical configuration tools, 354-355 Scorched 3D, 113 graphical development tools, 732-734 SuperTux, 114-115 graphical monitoring tools, 292 Warsow, 112 Conky, 294-298 Windows-based, 117 ethereal, 299 gcc command, 167 gnome-nettool, 298 gdb tool, 731 System Monitor, 292-294 gedit, 195 vncviewer, 298 GID (group ID), 206 graphics, 85 GIF file format, 88 capturing screen images, 89-90 GIMP (GNU Image Manipulation Program), formats, 88-89 72, 86 BMP file format, 88 Photoshop compared, 86 converting, 88-89 Simple Scan, 87 GIF file format, 88 GIMP Tool Kit (GTK), 72 JPG file format, 88 Git, 627-628 PCX file format, 88 Glade, 733-734 PNG file format, 88 GNOME (Gnu Network Object Model Environment), 106-107 SVG file format, 88 Gtk#, 745-746 TIF file format, 88 mailing list, 785 scanners, 87 GNOME File Roller, 312-313 Green, Andy, 375 GNOME Office, 72 grep command, 167, 175-176 AbiWord, 72 Groovy, 753 applications available for, additional, 72 Ground Control, 635-638 Evolution, 72 group listing, 207-208 if statement 801

group management, 207 specifications, researching, 8 tools for, 208-210 video, 96-97 UPG (user private group), 207 Harker, Kenneth, 783 group permissions, 148 hashes (Perl), 653 groupadd command, 209 Haskell, 754 groupdel command, 209 HBase, 565 groupmod command, 209 hdparm command, 401-402 groups command, 229 Helmke, Matthew, 726 grpck command, 209 Heuser, Werner, 783 GRUB2 (Grand Unified Boot Loader), 10 hidden files, 145 restoring, 326-327 Hipp, Richard, 559 Grün, Chrisian, 563 history of Internet, 53 Gtk#, 745-746 home directories, sharing, 440-441 GTK (GIMP Tool Kit), 72 /home directory, 140, 142 guides, Linux, 781 home use gunzip command, 199 backups, 305 gzip command, 199 Ubuntu, 773 Horde, 518 .htaccess configuration files, 467-469 H HTML forms, 699-700 http servers. See also Apache web server hackers, 384 Apache Tomcat, 490 Hadoop, 565 Cherokee, 488-489 Hamano, Junio, 627 Jetty, 489 handheld digital cameras, 90 lighttpd, 487 hard disk, performance tuning, 400-403 Nginx, 485-487 hard links, 178-180 thttpd, 489-490 hardware Yaws, 488 Android, 760 hubs and switches, 342-343 media backups, 308 hwclock command, 32 CD-RW drives, 308-309 cloud storage, 310 DVD+RW/-RW drives, 308-309 I network storage, 309 removable storage media, 308 IEEE (Institute of Electrical and Electronics tape drive, 309 Engineers), 363 networking devices, 339-346 if statement, 270-271

How can we make this index more useful? Email us at [email protected] 802 ifconfig command

ifconfig command, 346-349 Samba, 437-438 if/else statement, 657-658 from Server install CD, 8 ImageMagick, 88-89 Squid, 522 images, capturing screen, 89-90 step-by-step installation, 11-16 Imaging Service (Glance), 604 from USB drive, 11 Impress (LibreOffice), 68 from USB thumb drive, 9 incremental backups, 311-312 for Windows, 16-17 index, finding files in, 180 with Wubi, 16-17 InfraRecorder, 9 instance management, 617 init process, 279-280 instant messaging, 61 initializing network hardware, 344-346 Intel-based Linux distributions, 782 inittab file, 44 Internet insmod command, 416 cloud storage, 66 installation, 7 email client, choosing, 57-60 from Alternate install CD, 8 Firefox, 54-55 Apache web server, 457-460 Google Chrome, 55-56 backups before, 11 Google Chromium, 56-57 from CD, 11 history of, 53 creating a CD or DVD for, 9 instant messaging, 61 from Desktop CD, 8 IRC (Internet Relay Chat), 61-64 DHCP (Dynamic Host Configuration RSS readers, 60 Protocol), 357-358 Liferea, 60 for dual-boot system, 10-11 Live Bookmarks (Firefox), 60 from DVD, 11 Usenet newsgroups, 64-66 from DVD included with book, 8 Internet connections, 364 Fetchmail, 511 configuration, 364-365 first update, 16 dial-up Internet access, 368-369 games, 112-116 DSL (digital subscriber line), 366-368 LTSP (Linux Terminal Server Project), PPP (Point-to-Point Protocol), 368-369 579-580 PPPoE (Point-to-Point Protocol over NFS (Network File System), 434 Ethernet), 366-368 OpenStack, 604-613 troubleshooting, 369-370 Postfix, 506 Internet resources pre-installation, 7 Linux hardware specifications, researching, 8 search engines, 779 options for installation, choosing, 8-9 Websites, 778-779 partition strategies, planning, 10 last statement 803

Ubuntu, 777 compiling, 422-430 search engines, 779 configuring, 425-429 Websites, 778-779 Linux, 412 IP addresses, 333-335 source tree, 413-415 Squid client IP addresses, 527-528 types of, 415-416 IP masquerading, 335 version numbers, 413 IRC (Internet Relay Chat), 61-64, 785-786 modules, 416-418 IRCd, 64 numbering schema, 768 ISO Recorder, 9 patching, 421-422 ISPs (Internet Service Providers), 364-365 performance tuning, 401-402, 404-405 recompiling, 418-419 sources, 420-421 J troubleshooting, 429-430 versions, 419-420 Java, 754 key buffer usage, measuring, 407-408 JavaScript, 755 keyboard shortcuts, 51 Jetty, 489 key/value stores, 559-561 JPG file format, 88 Kile, 75 Juju, 131 kill command, 287-288 JVM (Java Virtual Machine), 754 Kirkland, Dustin, 586, 620, 639, 645 Kmail, 60 KOffice, 73 ksh shell, 237 K KSpread, 73 kate text editor, 195 ksysguard, 299 Katz, Damien, 559, 563 Kubuntu, 103-104 KDE, 102-104 KVM (Kernel-based Virtual Machine), 585-589 ark, 313 KWord, 73 mailing list, 785 monitoring clients, 299 window manager, 36 L KDevelop client, 732-733 kdf, 299 LAN, printer sharing on, 448-449 kedit, 195 Landscape, 131, 299 kernel, 142-144, 411-412 laptops, Linux on, 783 boot process, 277-278 large enterprise backups, 305 built-in protective services, 383 last statement, 660

How can we make this index more useful? Email us at [email protected] 804 LaTeX files

LaTeX files, 75 on desktop, 769 Launchpad, 629-630 distribution version, 768 LDAP (Lightweight Directory Access Protocol), documentation, 773-775, 780 567-568 guides, 781 administration, 572-574 Intel-based Linux distributions, 782 client configuration, 572-573 Internet resources directory, populating, 570-572 search engines, 779 Evolution, configuring, 572-573 Websites, 778-779 schema, creating your, 569 IRC (Internet Relay Chat), 785-786 server configuration, 568-572 on laptops, 783 Thunderbird, configuring, 572-573 mailing lists, 785 legacy printers, 453-454 mini-CD Linux distributions, 782 less command, 20, 158, 167, 176-178 on PDAs, 783 levels, backup, 306 Perl (Practical Extraction and Report /lib directory, 140 Language) with, 649-652 libraries PowerPC-based Linux distributions, 782 Android, 760 reasons for using, 769-770 Mono, 739, 745-746 as server platform, 769 LibreOffice, 67, 69 support for, 770 Base, 70 Usenet newsgroups, 783-784 Calc, 68 Linux kernel, 412 Dia, 70 Android, 760 Draw, 70 numbering schema, 768 history of, 71 source tree, 413-415 Impress, 68 types of, 415-416 Math, 68 version numbers, 413 Microsoft Office compatibility, 67 Linux Users Group (LUG), 780 PDF files, working with, 73-74 Lisp, 755 Planner, 70 listening to sound and music, 81-84 Writer, 68 lists, Python, 712-714 Liferea, 60 Live Bookmarks (Firefox), 60 lighttpd, 487 ln command, 167, 178-180 Linux, 767-768 local GUI client access to a database, 552 certification, 780 localhost interface, 330-333 commercial support, 780 locate command, 167, 180 cost of, 769, 770 logging in, 136-138 cross-platform development, 770 logging out, 137 memory, displaying free and used 805

logical operators mail user agent (MUA), 505 bash shell, 259-260 maildir system, 504 pdksh shell, 259-260 mailing lists tcsh shell, 263-264 Linux, 785 logname command, 229 Ubuntu, 775, 777, 785 logs, purging, 666-667 make command, 167, 727-729 Loh, Eugene, 753 make config utility, 424 loopback interface make menuconfig utility, 425 checking for availability of, 330 makefiles, 728-729 manually configuring, 331-333 man command, 167, 182-183 loops man pages, 163-164 Perl, 658-661 reading, 182-183 PHP, 685-687 Mandatory Access Control (MAC) system, 392 Python, 715-717 manual configuration /lost+found directory, 140 disk quotas, 228 Lovelace, Ada, 750 PPPoE (Point-to-Point Protocol over ls command, 145-148, 167, 180-182 Ethernet), 367-368 lsmod command, 416 Samba, 438-441 LTS (Long Term Support), 28 manually starting and stopping services at boot process, 283 LTSP (Linux Terminal Server Project), 575-576 masquerading (Postfix), 508 installation, 579-580 Mastering Regular Expressions requirements for, 576-579 (Freidl), 239 using, 580-581 Math (LibreOffice), 68 Lua, 756 mbox system, 504 Lubuntu, 106 MBR (Master Boot Record), 10, 277 LUG (Linux Users Group), 780 MDA (mail delivery agent), 503-505 LXDE, 105-106 autoresponders, 516 LyX, 75 choosing, 515-516 Procmail, 515 Spamassassin, 515-516 M Squirrelmail, 516 virus scanners, 516 Mackall, Matt, 627 /media directory, 140 macros in C/C++ programming language, Memcached, 561 728-729 MemcacheDB, 561 mail relaying, 510 memory, displaying free and used, 290 mail transfer agents. See MTA

How can we make this index more useful? Email us at [email protected] 806 Mercurial

Mercurial, 626-627 Mono, 737-738 Message of the day (MOTD) file, 161 Base Class Library, 739 Microsoft Exchange Server, alternatives to, C# compiler, 738-739 517-518 libraries, expanding, 745-746 Microsoft Exchange Server/Outlook client, 517 reasons for using, 738-739 Microsoft Windows, productivity applications Mono Runtime, 739 for, 76 MonoDevelop, 739-745 Midnight Commander, 321-322 MOTD (Message of the day) file, 161 mini-CD Linux distributions, 782 mounting Samba shares, 443-444 mirroring data, 307 MOV file format, 97 mkdir command, 154, 168, 183 moving files, 156 mkisofs command, 92-93 Mozilla Firefox, 54-55 /mnt directory, 140 Mozilla Thunderbird, 59 modprobe command, 345-346, 417 MP3 file format, 79-80 modules MPEG file format, 97 Apache web server, 474-480 MS-DOS, command line compared, 135 kernel, 416-418 MTA (mail transfer agents), 502 Perl (Practical Extraction and Report Language), 663, 665 choosing, 503 MongoDB, 563 Exim, 503 monitoring tools Postfix, 503 console-based monitoring, 285-287 Qmail, 503 disk quotas, 291 Sendmail, 502-503 disk space, displaying free and used, MUA (mail user agent), 505 291 multicasting, 339 kill command, 287-288 multimedia applications memory, displaying free and used, 290 CDs priority scheduling and control, 288-290 burning, 90 enterprise server monitoring, 299 creating, 91-96 graphical monitoring tools, 292 digital cameras, 90-91 Conky, 294-298 DVDs ethereal, 299 burning, 90 gnome-nettool, 298 creating, 91-96 System Monitor, 292-294 graphics, 85 vncviewer, 298 capturing screen images, 89-90 KDE monitoring clients, 299 formats, 88-89 Landscape, 299 scanners, 87 monitoring user activity, 216 networking 807

sound and music, 78, 81-84 N buying, 84 formats, 79-81 name-based virtual hosts, 481-482 listening to, 81-84 nano, 194-196 sound cards, 78-79 NcFTPd server, 492-493 volume, adjusting, 79-80 Nessus, 386 video netpbm tools, 89 editing, 99-100 netstat command, 350-351 formats, 97-98 network cable, 341 hardware, 96-97 coaxial cable, 341 personal video recorders, 99 fiber-optic cable, 342 viewing, 98-99 UTP (unshielded twisted pair), 341-342 multiple terminals, using, 200-201 Network File System. See NFS multiprocessing modules (Apache web network hosts, configuring, 359-361 server), 467 network interface cards (NIC), 339 music. See sound and music fiber optics, 340 Mutt, 60 100BASE-T, 340 mv command, 156, 168, 183 1000BASE-T, 340 MySQL, 540 10BASE-T, 340 ACID compliance, 542 Token Ring, 339 configuring, 543-546 wireless network interfaces, 341 creating database in, 544-546 Network Manager utility, 33-34 data locking, 541 Network News Transfer Protocol (NNTP), 65 key buffer usage, measuring, 407-408 networking, 334 performance tuning, 406-410 commands used in, 370 procedural language, 543 DHCP (Dynamic Host Configuration query cache, 408-409 Protocol), 355-361 query optimization, 410 hardware devices for, 339-346 root user, setting password for, 544 IP masquerading, 335 speed, 540-541 localhost interface, 330-333 SQL subqueries, 542 loopback interface triggers, 543 checking for availability of, 330 mysql command, 556 manually configuring, 331-333 MySQL command-line client, 553-554 TCP/IP, 333 mysqladmin command, 556 addressing, 333-335 mysqldump command, 556 ports, 335-337 Mythbuntu project, 99

How can we make this index more useful? Email us at [email protected] 808 networks

networks Memcached, 561 backups, network storage used for, 309 MemcacheDB, 561 classes, 333-335 MongoDB, 563 configuration, 346 Redis, 561 command line network interface wide column stores, 563-565 configuration, 346-351 number comparison files, 351-353 bash shell, 257-258 graphical configuration tools, 354-355 pdksh shell, 257-258 organization, 337-339 tcsh shell, 261-262 subnet masks, 338 numbers (Python), 708-709 subnets, 337-338 Nvidia, 110 wireless advantages of, 363 options for, 363-364 support for, 361-362 O newusers command, 229 OASIS OpenDocument format, 70 NFS (Network File System), 434 object orientation (Python), 718-722 client configuration, 436-437 object variables (Python), 719-720 installing, 434 Ogg-Vorbis file format, 80 server configuration, 434-436 OGV/OGG file format, 97 starting, 434 100BASE-T, 340 stopping, 434 1000BASE-T, 340 Nginx, 485-487 one-liners (Perl), 668 Nmap, 386 Open Printing database, 30 NNTP (Network News Transfer Protocol), 65 Open Sound System (OSS), 78-79 nonbooting hard drive, saving files from, 327 OpenDocument format, 70 NoSQL, 533, 557-559 OpenOffice.org, 71 advantages of, 558 open-source software, 27 BaseX, 563 OpenStack, 603 Berkeley DB, 560 commands for, 618 BigTable, 565 Compute Infrastructure (Nova), 603-604 Cassandra, 560-561 image creation, 614-616 CouchDB, 563 Imaging Service (Glance), 604 disadvantages of, 558-559 installation, 604-613 document stores, 562-563 instance management, 617 HBase, 565 network management, 618 key/value stores, 559-561 resources for, 619 Perl (Practical Extraction and Report Language) 809

Storage Infrastructure (Swift), 604 passwords, 15, 387 storage management, 617 command line, 136 Open-Xchange, 518 managing operators changing passwords in a batch, 220 Perl, 654-657 shadow passwords, 218-220 PHP, 679-681 system password policy, 217 special, 683 users, managing password security opportunistic development, 623, 629 for, 220 Bikeshed, 639-640 for new users, 160 Ground Control, 635-638 shadow password system, 494-495 Launchpad, 629-630 pastebinit script, 640 Quickly, 631-634 patching kernels, 421-422 version control systems, 624-628 pattern-matching support, 239-240 /opt directory, 140 PCX file format, 88 Options directive, 468-469 PDAs, Linux on, 783 Oracle Beehive, 518 PDF Editor, 74 organization of networks, 337-339 PDF files OSS (Open Sound System), 78-79 LibreOffice working with, 73-74 others permissions, 148 productivity applications for, 73-74 output and input, redirecting, 187-189 pdksh shell, 237 owner permissions, 148 PEAR, 700-702 performance tuning, 399-400 Apache, 405-406 BIOS, 400-401 P hard disk, 400-403 kernel, 404-405 package listings, 779 MySQL, 406-410 package numbering, 130 Perl (Practical Extraction and Report packet writing, 95-96 Language), 649 paging through output, 176-178 arrays, 653 PAM (Pluggable Authentication Modules), 221 code examples, 664-669 Pan, 66 command-line processing, 668 parent directory, 145 commands for, 669 partition strategies, planning, 10 conditional statements, 657-658 passwd command, 211, 229 CPAN (Comprehensive Perl Archive password file, 217-218 Network), 663, 665-666 hashes, 653

How can we make this index more useful? Email us at [email protected] 810 Perl (Practical Extraction and Report Language)

if/else statement, 657-658 personal video recorders, 99 with Linux, 649-652 PHP, 671-672 logs, purging, 666-667 arrays, 674-676 looping, 658-659 comments, 677 foreach loop, 659 conditional statements, 681-682 last statement used to end, 660 constants, 676 for loop, 659 databases, 700-702 redo statement, 660-661 entering/exiting PHP mode, 672 until loop, 660-661 escape sequences, 678 while loop, 660-661 functions, 696-699 modules, 663, 665 arrays, 692-693 one-liners, 668 files, 694-695 operators, 654, 656-657 strings, 688-691 arithmetic, 655-656 HTML forms, 699-700 comparison, 654-655 including other files, 687-688 compound, 655 loops, 685-687 regular expressions, 661-662 operators, 679-681 scalar variables, 653 special, 683 sending mail, 664-665 PEAR, 700-702 shell access, 662-663 references, 676-677 simple program, 650-652 switching, 683-685 string constants, special, 657 terminating script processing, 696 unless statement, 658 variables, 673-674 Usenet, posting to, 667 setting/unsetting, 696 variables, 653-654 substitution, 679 versions, 650 PHP and MySQL Development permissions, 148 (Welling and Thompson), 546 altering, 150-152 phpgroupware, 518 assigning, 148-149 PHProjekt, 518 changing, 171 physical security, 388 command line, 148-153 piping, 167, 241 directory, 150 PiTiVi video editor, 99 group, 148, 206-207 Planner (LibreOffice), 70 others, 148 playing CDs, 81-83 owner, 148 Pluggable Authentication Modules (PAM), 221 sgid (set group ID), 152-153 PNG file format, 88 suid (set user ID), 152-153 podcasts, 82 Procmail 811

positional parameters, 247-249 sudo command, 21 command line, using positional parameters system settings, configuring, 28-32 to access and retrieve variables from, 249 troubleshooting, 19-20 example, 248 wireless networks, 33-34 Postfix, 503 power management, configuring, 30-31 aliases, forwarding an email with, 510-511 power shortcuts, 51 configuring, 506-508 PowerPC-based Linux distributions, 782 delivery intervals, setting message, 509 PPP (Point-to-Point Protocol), 368-369 installing, 506 PPPoE (Point-to-Point Protocol over Ethernet), mail relaying, 510 366-368 masquerading, 508 pre-installation, 7 smart hosts, 509 hardware specifications, researching, 8 Postfix: The Definitive Guide options for installation, choosing, 8-9 (Dent), 508 partition strategies, planning, 10 PostgreSQL, 540 printer sharing, 433, 448 ACID compliance, 542 all-in-one (print/fax/scan) devices, 453 configuring, 546-549 commands for, 454 creating database in, 547-548 CUPs (Common UNIX Printing System), data directory, initializing, 547 448-452 data locking, 541 on LAN, 448-449 privileges, granting and revoking, 549 legacy printers, 453-454 procedural language, 543 Samba, 441 speed, 540-541 SMB printing, 449-450 SQL subqueries, 542 troubleshooting, 453-454 triggers, 543 USB printers, 453-454 users printers, detecting and configuring, 30 creating, 548 print/fax/scan devices, 453 deleting, 548-549 priority scheduling and control, 288-290 PostgreSQL command-line client, 555 private deployment of Ubuntu Cloud, 596-597, 598-601 post-installation configuration privileges date and time, setting, 31-32 PostgreSQL, granting and revoking, 549 drivers, installing additional, 28-29 system administrator privileges to regular power management, configuring, 30-31 users, granting, 220-226 printers, detecting and configuring, 30 /proc directory, 140, 142-144 programs and files, finding, 21 procedural language, 543 software repositories, configuring, 26-28 processes, listing, 184 software updates, 22-25 Procmail, 515

How can we make this index more useful? Email us at [email protected] 812 productivity applications

productivity applications, 67-68 macros, 728-729 CrossOver Office, 76 make command, 727-729 for DocBook files, 75 makefiles, 728-729 Evince, 73 promiscuous mode, 389 GNOME Office, 72 proprietary software, 27 AbiWord, 72 proprietary video drivers for games, installing, applications available for, additional, 72 110-111 Evolution, 72 proxy servers, 521 GIMP,72 Squid Gnumeric, 72 ACLs (access control lists), 523-527, 528-529 Kile, 75 client configuration, 522 KOffice, 73 client IP addresses, 527-528 for LaTeX files, 75 installing, 522 LibreOffice, 69 ps command, 168, 184 Base, 70 psql command, 556 Calc, 68 public deployment of Ubuntu Cloud, 596-598 Dia, 70 PulseAudio, 78-79 Draw, 70 Puppet, 131 history of, 71 pwd command, 137, 147 Impress, 68 Python, 705-706 Math, 68 class inheritance, 721-722 Microsoft Office compatibility, 67 class variables, 719-720 PDF files, working with, 73-74 conditional statements, 715-717 Planner, 70 constructors and destructors, 720-721 Writer, 68 dictionaries, 714-715 LyX, 75 functions, 717-718 for Microsoft Windows, 76 on Linux, 706-707 for PDF files, 73-74 lists, 712-714 Texmaker, 75 loops, 715-717 Wine, 76 numbers, 708-709 for XML files, 74-75 object orientation, 718-722 ProFTPD server, 493 object variables, 719-720 programming languages, 749-750. See also specific programming languages Python Package Index, 723 project management tools Standard Library, 723 C/C++ programming language, 727-731 strings, 709-712 autoconf utility, 729-730 versions, 705-706 debugging tools, 730-731 Python Package Index, 723 runtime server configuration settings 813

Q Telnet setting up, 373-374 Qmail, 503 SSH compared, 375 QT file format, 98 (VNC) virtual network computing, 379-380 query cache (MySQL), 408-409 removable storage media, 308 query optimization (MySQL), 410 removing software, 121, 126-127 quick guide to Apache web server, 460 renaming files, 156 Quickly, 631-634 repeat statement, 268 repeatedly running tasks, 234-236 resource usage, printing, 186-187 R restarting your computer, 18 restoring files from an archive with tar tool, 312 RAID arrays, 307 retrieving data from, 538-540 RAW file format, 79 RFC (Request for Comments), 65 RDBMS (relational database Rhythmbox, 81-83 management), 533 ripping CDs, 81-83 how it works, 533-535 rm command, 155-156, 168, 184-185 tables rmdir command, 154-155 creating, 536-537 rmmod command, 417 data, inserting, 537-538 /root directory, 140 rebooting system, 162 root user, setting password for, 544 recompiling kernel, 418-419 rootsign tool, 641 Redis, 561 route command, 349-350 redo statement, 660-661 routers, 343 references (PHP), 676-677 rsh shell, 237 regular expressions (Perl), 661-662 rsync, 322-323 regular user permissions, 205 Ruby, 756 reinstalling software, 121 runlevels, 44, 278 remote access booting into default, 279 command line, 137-138 changing, 281 SSH definitions, 278-279 copying files between machines, 376 troubleshooting, 282-283 copying many files between running new shell program, 243-244 machines, 377 running services at boot, 276 key-based logins, 377-379 run-one tool, 640 setting up, 375 run-this-one tool, 640 tools, 375-379 runtime server configuration settings (Apache web server), 463-469

How can we make this index more useful? Email us at [email protected] 814 Samba

S physical, 388 promiscuous mode, 389 Samba, 437-438 Tripwire, 388-389 configuring, 444-448 UFW (Uncomplicated Firewall), 390-393 global behavior, setting, 440 viruses, 389-390 home directories, sharing, 440-441 vulnerability, assessing your, 385-386 installation, 437-438 wireless networks, 387 manually configuring, 438-441 select statement, 269 mounting Samba shares, 443-444 sending email, 664-665 printers, sharing, 441 Sendmail, 502-503 testing, 442 Server install CD, 8 Samba Web Administration Tool (SWAT), server platform, Linux as, 769 444-448 servers /sbin directory, 140-141 FTP Scala, 756-757 choosing, 491-493 scalar variables (Perl), 653 setting up, 495 scanners, 87 http scheduling tasks, 231-236 Apache Tomcat, 490 Schwartz, Randal, 668 Cherokee, 488-489 Scorched 3D, 113 Jetty, 489 scp command, 376 lighttpd, 487 screen command, 200 Nginx, 485-487 screen grab, 89 thttpd, 489-490 screenshot, 89 Yaws, 488 security LDAP (Lightweight Directory Access AppArmor, 392-395 Protocol), 568-572 computer attacks, 384-385 NFS (Network File System), 434-436 devices, 389 service set identifier (SSID), 33 disaster recovery plan, 395-396 session writing, 94-95 employees, 388 setting/unsetting variables in PHP, 696 firewalls, 390-393 sftp command, 377 kernel, built-in protective services in, 383 sgid (set group ID) permissions, 152-153 passwords, 15, 387 sh shell, 237 command line, 136 shadow passwords, 218-220, 494-495 management, 217-220 shared data, 144 for new users, 160 shebang line, 245 shadow password system, 494-495 software 815

shell scripts, 242-243 ksh, 237 automating tasks, using simple script for, output redirection, 240-241 249-251 pattern-matching support, 239-240 / (backslash), 254 pdksh, 237 ` (backtick), 255 piping data, 241 break statement, 273 rsh, 237 built-in variables, 251 sh, 237 case statement, 271-273 tcsh, 237 ” (double quotes), 253 zsh, 237 endless loops, 267 shift statement, 269 exit statement, 273 Shotwell Photo Manager, 85, 90 for statement, 264-266 shutdown command, 18, 161, 162 functions, 273-274 shutting down system, 161 if statement, 270-271 Shuttleworth, Mark, 45, 771 positional parameters, 247-249 simple program (Perl), 650-652 repeat statement, 268 Simple Scan, 87 running new shell program, 243-244 simple strategy for backups, 306 select statement, 269 ’ (single quotes), 254 shells, interpreting shell scripts through 64-bit Ubuntu, 773 specific, 245-246 Skolnick, Cliff, 456 shift statement, 269 Slashdot Effect, 405 ’ (single quotes), 254 small enterprise backups, 305 special characters used in, 252-255 small office backups, 305 storing for systemwide access, 244 smart hosts (Postfix), 509 until statement, 268 SMB printing, 449-450 variables in, 246-247 smbclient command, 443 while statement, 266 smbstatus command, 442-443 shells, 236-237 software background processing, 241-242 backups, 310 bash, 237 Amanda, 310, 318-319 command line, 237-239 Back In Time, 315-316 comparison of expressions, 255-264 Déjà Dup, 313-316 documentation on, 237 GNOME File Roller, 312-313 input redirection, 240-241 KDE ark, 313 interpreting shell scripts through specific, 245-246 tar tool, 310-312 Unison, 317-318

How can we make this index more useful? Email us at [email protected] 816 software

management sources, kernel, 420-421 from command line, 123-128 Spamassassin, 515-516 compiling from source, 128-130 special characters used in shell scripts, deleting software, 121 252-255 finding software, 127-128 special operators in PHP, 683 reinstalling software, 121 splint command, 730-731 removing software, 121, 126-127 SQL, 536 server/configuration management, retrieving data, 538-540 131-132 subqueries, 542 Software Center, 119-120 tables Synaptic, 120-122 creating, 536-537 Update Manager, 123 data, inserting, 537-538 updating software, 22-25, 123-126 Squid upgrading software, 121 ACLs (access control lists), 523-527, repositories 528-529 compiling software from, 129-130 client configuration, 522 configuring, 26-28 client IP addresses, 527-528 Software Center, 119-120 installing, 522 Software Sources, 26-28 Squirrelmail, 516 sound and music, 78, 81-84 /srv directory, 140 buying, 84 SSH formats, 79-81 access to a database, 550-551 converting, 81 copying files between machines, 376 FLAC file format, 80 copying many files between machines, 377 MP3 file format, 79-80 key-based logins, 377-379 Ogg-Vorbis file format, 80 setting up, 375 RAW file format, 79 Telnet compared, 375 WAV file format, 79 tools, 375-379 listening to, 81-84 ssh client, 137-138 sound cards, 78-79 ssh command, 168 volume, adjusting, 79-80 ssh-import-id tool, 641 sound cards, 78-79 ssh-keygen command, 377-379 Sound Juicer, 84 SSID (service set identifier), 33 source code for Apache web server, building, Stallman, Richard M., 197, 768 458-460 Standard Library (Python), 723 system user permissions 817

Stanzione, Dan, 726 sudo command, 21, 139-140, 205, StarOffice, 71 224-226, 229 starting/stopping suid (set user ID) permissions, 152-153 Apache web server, 461-463 super user (root) account, 158-159 X Window System, 43 command line, 158-162 step-by-step installation, 11-16 command line, making changes from, 138-139 stereotypes, 207 creating users, 159-160 Storage Infrastructure (OpenStack), 604 deleting users, 160 storage management, 617 rebooting system, 162 strategy for backups shutting down system, 161-162 choosing, 301-304, 307 super user/root use permissions, 204-205 evaluating, 305-307 SuperTux, 114-115 full backup on periodic basis, 306 support for Linux, 770 full backups with incremental backups, 307 SVG file format, 88 mirroring data, 307 SWAT (Samba Web Administration Tool), RAID arrays, 307 444-448 simple, 306 switching (PHP), 683-685 string comparison symbolic links, 178-180 bash shell, 255-257 Synaptic, 120-122 pdksh shell, 255-257 sync command, 402 tcsh shell, 260-261 /sys directory, 140 string searches, 175-176 sysctl command, 404 strings system administrator, 594 Perl, 657 privileges to regular users, granting, PHP, 688-691 220-226 Python, 709-712 System Monitor, 292-294 StumbleUpon plug-in, 55 system password policy, 217 su command, 222-224, 229 system rescue, 326 subnet masks, 338 GRUB2 boot loader, restoring, 326-327 subnets, 337-338 nonbooting hard drive, saving files from, 327 subqueries, SQL, 542 Ubuntu rescue disc, 326 substitution variables in PHP, 679 system settings, configuring, 28-32 Subversion, 624-625 system user permissions, 206

How can we make this index more useful? Email us at [email protected] 818 tables (database)

T Texmaker, 75 text editors, 194-199 tables (database) emacs, 194, 197-199 creating, 536-537 gedit, 195 data, inserting, 537-538 kate, 195 tail command, 168, 185 kedit, 195 tape drive backups, 309 nano, 194-196 tar command, 199, 319-320 vi, 195-197 tar tool, 310-312 text-based console login, 136-137 full backups, 311 Thompson, Laura, 546 incremental backups, 311-312 thttpd, 489-490 restoring files from an archive with, 312 Thunderbird, 59, 572-573 tarball, compiling software from, 128-129 TIF file format, 88 Taylor, David, 78 Time & Date GUI, 31-32 TCP/IP, 333 time and date addressing, 333-335 setting, 31 ports, 335-337 with date command, 31 tcsh shell, 237 with hwclock command, 32 Teach Yourself TCP/IP Network Administration with Time & Date GUI, 31-32 in 21 Days (Sams), 338 TiVo, 99 Telnet /tmp directory, 140, 144 setting up, 373-374 Token Ring, 339 SSH compared, 375 top command, 168, 186-187 temporary file storage, 144 Torvalds, Linus Benedict, 412, 627, 767 10BASE-T, 340 Totem Movie Player, 98 Terminal, 135 touch command, 148, 153-154 terminating script processing (PHP), 696 triggers, 543 Test Drive, 645-648 Tripwire, 388-389 testing troubleshooting, 19-20 Samba, 442 Google used for, 20 Ubuntu, 643, 775 Internet connections, 369-370 Bug Squad, 645 kernel, 429-430 community teams, 643-645 printer sharing, 453-454 Test Drive, 645-648 runlevels, 282-283 Ubuntu QA Team, 645 tune2fs command, 402-403 Ubuntu Testing Team, 644 TV viewing, 96-100 testparm command, 442 USB thumb drive, installation from 819

U Ubuntu One, 66, 84 Ubuntu Orchestra Project, 620 Ubuntu, 770-771 Ubuntu Project mailing lists, 785 for business use, 771-772 Ubuntu QA Team, 645 commercial support, 780 Ubuntu rescue disc, 326 Debian as base of, 770 Ubuntu Software Center, 116 documentation, 773-775 Ubuntu Testing Team, 644 assisting with, 775 UFW (Uncomplicated Firewall), 390-393 flavors (variants), list of, 9 UID (user ID), 206 for home use, 773 unicast addresses, 338 Internet resources, 777 Unison, 317-318 search engines, 779 Unity, 45 Websites, 778-779 configuring, 50 IRC (Internet Relay Chat), 785-786 customizing, 50 mailing lists, 775, 777, 785 Dash, 46-49 package listings, 779 desktop, 45 repositories, Apache web server installed keyboard shortcuts, 51 from, 457-458 Launcher, 45-46 64-bit, 773 panel, 48-49 testing, 643, 775 system settings, 50 Bug Squad, 645 Workspaces, 46 community teams, 643-645 Universal USB Installer, 9 Test Drive, 645-648 unless statement, 658 Ubuntu QA Team, 645 UnQL (Unstructured Query Language), 559 Ubuntu Testing Team, 644 unshielded twisted pair (UTP), 341-342 versions, 771 until loop, 660-661 web forums, 781 until statement, 268 Ubuntu Cloud, 593 Update Manager deploying, 596-597 checking for software updates, 22 private deployment, 596-601 software management, 123 public deployment, 596-598 updating software, 22-25, 123-126 Ecua2ools, 597, 601-603 UPG (user private group), 207 and Eucalyptus, 595-603 upgrading software, 121 Juju, managing and monitoring with, 619 Upstart, 283-284 Landscape, managing and monitoring USB drive, installation from, 11 with, 619 USB printers, 453-454 and OpenStack, 603-619 USB thumb drive, installation from, 9 Orchestra, deployment with, 620

How can we make this index more useful? Email us at [email protected] 820 Usenet newsgroups

Usenet newsgroups, 64-66, 667, 783-784 file permissions, 206-207 user management GID (group ID), 206 adding new users, 212-216 regular users, 205 commands for, 228-229 super user/root user, 204-205 disk quotas, 227 system users, 206 implementing, 227-228 UID (user ID), 206 manually configuring quotas, 228 FTP (File Transfer Protocol), 494-496 group management, 207 managing password security for, 220 group listing, 207-208 PostgreSQL tools for, 208-210 creating, 548 UPG (user private group), 207 deleting, 548-549 monitoring user activity, 216 /usr directory, 37-38, 140, 144 password management UTP (unshielded twisted pair), 341-342 changing passwords in a batch, 220 password file, 217-218 shadow passwords, 218-220 V system password policy, 217 users, managing password security Vala, 757 for, 220 /var directory, 140, 144-145 stereotypes, 207 var_dump function, 697 system administrator privileges to regular users, granting, 220-226 variable data files, 144-145 tools for, 210-212 variables user accounts, 203-204 accessing variable values, 247 file permissions, 206-207 assigning value to, 246-247 GID (group ID), 206 C#, 744 regular users, 205 Perl (Practical Extraction and Report Language), 653-654 super user/root user, 204-205 PHP, 673-674 system users, 206 setting/unsetting, 696 UID (user ID), 206 substitution, 679 user variables, 246 in shell scripts, 246-247 useradd command, 210-211, 229 version control for configuration files, 323-326 userdel command, 211 version control systems, 624-628 usermod command, 212, 229 Bazaar, 625-626 users. See also user management Git, 627-628 accounts, 203-204 Mercurial, 626-627 command line, 138-140 Subversion, 624-625 Fetchmail, 513-514 wireless network interfaces 821

versions (VNC) virtual network computing, 379-380 kernel, 419-420 vncviewer, 298 Perl (Practical Extraction and Report vsftpd server, 492 Language), 650 configuring, 496-499 Python, 705-706 vulnerability, assessing your, 385-386 Ubuntu, 771 vi, 195, 196-197 video editing, 99-100 W formats, 97-98 Warsow, 112 AVI file format, 97 WAV file format, 79 FLV file format, 97 Web access to a database, 552-553 MOV file format, 97 web forums for Ubuntu, 781 MPEG file format, 97 web servers. See also Apache web server OGV/OGG file format, 97 Apache Tomcat, 490 QT file format, 98 Cherokee, 488-489 WEBM file format, 98 Jetty, 489 hardware, 96-97 lighttpd, 487 personal video recorders, 99 Nginx, 485-487 viewing, 98-99 thttpd, 489-490 vim command, 168 Yaws, 488 virtual hosting, 480 WEBM file format, 98 address-based virtual hosts, 480 Welling, Luke, 546 Apache web server, 480-482 whereis command, 163 name-based virtual hosts, 481-482 which command, 168, 187 VirtualBox, 589-590 while loop, 660-661, 685-686 virtualization, 583-585 while statement, 266 KVM (Kernel-based Virtual Machine), 585-589 wide column stores, 563-565 VirtualBox, 589-590 wildcards, 158 VMware, 591 window managers, 36 Xen, 591 changing, 44 virus scanners, 390, 516 Windows viruses, 389-390 games based on, 117 VLC media player, 99 installation, 16-17 VM (virtual machine), 584. See also Wine, 76, 117 virtualization wireless network interfaces, 341 VMware, 591 wireless networking

How can we make this index more useful? Email us at [email protected] 822 wireless networking

advantages of, 363 XML files, productivity applications for, 74-75 options for, 363-364 X.Org foundation, 35-36 support for, 361-362 xorg.conf file, 38-39 wireless networks, 33-34 Device section, 42 security, 387 Files section, 39-40 Workspaces (Unity), 46 InputDevice section, 40-41 Writer (LibreOffice), 68 Module section, 40 Wubi, installation with, 16-17 Monitor section, 41 wu-ftp server, 493 Screen section, 42-43 ServerLayout section, 39 Xubuntu, 105 X X Window System, 35-37, 783 Y–Z advantages, 36-37 display manager, using, 44 Yaws, 488 starting, 43 using, 37-38 zsh shell, 237 /usr directory, 37-38 Xamarin, 738 xargs command, 168 XChat, 62-64 Xen, 591 Xfce, 36, 104-105 Xmarks plug-in, 55 XML Copy Editor, 75 This page intentionally left blank