Fork me on GitHub

Project Notes

Linux Server Hacks

Book notes - Linux Server Hacks by Rob Flickenger and Linux Server Hacks, Volume Two (Tips & Tools for Connecting, Monitoring, and Troubleshooting) by William von Hagen and Brian K. Jones, published by O’Reilly.

Notes

Linux Server Hacks Volume 1: Table of Contents - Highlights

1. Server Basics

    1. Removing Unnecessary Services
    1. Forgoing the Console Login
    1. Common Boot Parameters
    1. Creating a Persistent Daemon with init
    1. n>&m: Swap Standard Output and Standard Error
    1. Building Complex Command Lines
    1. Working with Tricky Files in xargs
    1. Immutable Files in ext2/ext3
    1. Speeding Up Compiles
    1. At Home in Your Shell Environment
    1. Finding and Eliminating setuid/setgid Binaries
    1. Make sudo Work Harder
    1. Using a Makefile to Automate Admin Tasks
    1. Brute Forcing Your New Domain Name
    1. Playing Hunt the Disk Hog
    1. Fun with /proc
    1. Manipulating Processes Symbolically with procps
    1. Managing System Resources per Process
    1. Cleaning Up after Ex-Users
    1. Eliminating Unnecessary Drivers from the Kernel
    1. Using Large Amounts of RAM
    1. hdparm: Fine Tune IDE Drive Parameters

2. Revision Control

    1. Getting Started with RCS
    1. Checking Out a Previous Revision in RCS
    1. Tracking Changes with rcs2log
    1. Getting Started with CVS
    1. CVS: Checking Out a Module
    1. CVS: Updating Your Working Copy
    1. CVS: Using Tags
    1. CVS: Making Changes to a Module
    1. CVS: Merging Files
    1. CVS: Adding and Removing Files and Directories
    1. CVS: Branching Development
    1. CVS: Watching and Locking Files
    1. CVS: Keeping CVS Secure
    1. CVS: Anonymous Repositories

3. Backups

    1. Backing Up with tar over ssh
    1. Using rsync over ssh
    1. Archiving with Pax
    1. Backing Up Your Boot Sector
    1. Keeping Parts of Filesystems in sync with rsync
    1. Automated Snapshot-Style Incremental Backups with rsync
    1. Working with ISOs and CDR/CDRWs
    1. Burning a CD Without Creating an ISO File

4. Networking

    1. Creating a Firewall from the Command Line of any Server
    1. Simple IP Masquerading
    1. iptables Tips & Tricks
    1. Forwarding TCP Ports to Arbitrary Machines
    1. Using Custom Chains in iptables
    1. Tunneling: IPIP Encapsulation
    1. Tunneling: GRE Encapsulation
    1. Using vtun over ssh to Circumvent NAT
    1. Automatic vtund.conf Generator

5. Monitoring

    1. Steering syslog
    1. Watching Jobs with watch
    1. What’s Holding That Port Open?
    1. Checking On Open Files and Sockets with lsof
    1. Monitor System Resources with top
    1. Constant Load Average Display in the Titlebar
    1. Network Monitoring with ngrep
    1. Scanning Your Own Machines with nmap
    1. Disk Age Analysis
    1. Cheap IP Takeover
    1. Running ntop for Real-Time Network Stats
    1. Monitoring Web Traffic in Real Time with httptop

6. SSH

    1. Quick Logins with ssh Client Keys
    1. Turbo-mode ssh Logins
    1. Using ssh-Agent Effectively
    1. Running the ssh-Agent in a GUI
    1. X over ssh
    1. Forwarding Ports over ssh

7. Scripting

    1. Get Settled in Quickly with movein.sh
    1. Global Search and Replace with Perl
    1. Mincing Your Data into Arbitrary Chunks (in bash)
    1. Colorized Log Analysis in Your Terminal

8. Information Servers

    1. Running BIND in a chroot Jail
    1. Views in BIND 9
    1. Setting Up Caching DNS with Authority for Local Domains
    1. Distributing Server Load with Round-Robin DNS
    1. Running Your Own Top-Level Domain
    1. Monitoring MySQL Health with mtop
    1. Setting Up Replication in MySQL
    1. Restoring a Single Table from a Large MySQL Dump
    1. MySQL Server Tuning
    1. Using proftpd with a mysql Authentication Source
    1. Optimizing glibc, linuxthreads, and the Kernel for a Super MySQL Server
    1. Apache Toolbox
    1. Display the Full Filename in Indexes
    1. Quick Configuration Changes with IfDefine
    1. Simplistic Ad Referral Tracking
    1. Mimicking FTP Servers with Apache
    1. Rotate and compress Apache Server Logs
    1. Generating an SSL cert and Certificate Signing Request
    1. Creating Your Own CA
    1. Distributing Your CA to Client Browsers
    1. Serving multiple sites with the same DocumentRoot
    1. Delivering Content Based on the Query String Using mod_rewrite
    1. Using mod_proxy on Apache for Speed
    1. Distributing Load with Apache RewriteMap
    1. Ultrahosting: Mass Web Site Hosting with Wildcards, Proxy, and Rewrite

Linux Server Hacks, Volume Two: Table of Contents - Highlights

Tips & Tools for Connecting, Monitoring, and Troubleshooting

1. Linux Authentication

    1. Disable User Accounts Instantly
    1. Edit Your Password File for Greater Access Control
    1. Deny All Access in One Second or Less
    1. Customize Authentication with PAMs
    1. Authenticate Linux Users with a Windows Domain Controller
    1. Centralize Logins with LDAP
    1. Secure Your System with Kerberos
    1. Authenticate NFS-Lovers with NIS
    1. Sync LDAP Data with NIS

2. Remote GUI Connectivity

    1. Access Systems Remotely with VNC
    1. Access VNC Servers over the Web
    1. Secure VNC via SSH
    1. Autostart VNC Servers on Demand
    1. Put Your Desktops on a Thin Client Diet (LTSP)
    1. Run Windows over the Network
    1. Secure, Lightweight X Connections with FreeNX
    1. Secure VNC Connections with FreeNX
    1. Secure Windows Terminal Connections with FreeNX
    1. Remote Administration with Webmin

3. System Services

    1. Quick and Easy DHCP Setup
    1. Integrate DHCP and DNS with Dynamic DNS Updates (BIND, ISC DHCP)
    1. Synchronize Your Watches!
    1. Centralize X Window System Font Resources
    1. Create a CUPS Print Server
    1. Configure Linux Connections to Remote CUPS Printers
    1. Integrate Windows Printing with CUPS
    1. Centralize Macintosh Printing with CUPS
    1. Define a Secure CUPS Printer

4. Cool Sysadmin Tools and Tips

    1. Execute Commands Simultaneously on Multiple Servers
    1. Collaborate Safely with a Secured Wiki (MediaWiki)
    1. Edit Your GRUB Configuration with grubby
    1. Give Your Tab Key a Workout
    1. Keep Processes Running After a Shell Exits (nohup, disown)
    1. Disconnect Your Console Without Ending Your Session (screen)
    1. Use script to Save Yourself Time and Train Others
    1. Install Linux Simply by Booting
    1. Turn Your Laptop into a Makeshift Console
    1. Usable Documentation for the Inherently Lazy
    1. Exploit the Power of Vim
    1. Move Your PHP Web Scripting Skills to the Command Line
    1. Enable Quick telnet/SSH Connections from the Desktop
    1. Speed Up Compiles (distcc)
    1. Avoid Common Junior Mistakes
    1. Get Linux Past the Gatekeeper
    1. Prioritize Your Work

5. Storage Management and Backups

    1. Create Flexible Storage with LVM
    1. Combine LVM and Software RAID
    1. Create a Copy-on-Write Snapshot of an LVM Volume
    1. Clone Systems Quickly and Easily (partimage)
    1. Make Disk-to-Disk Backups for Large Drives
    1. Free Up Disk Space Now
    1. Share Files Using Linux Groups
    1. Refine Permissions with ACLs
    1. Make Files Easier to Find with Extended Attributes
    1. Prevent Disk Hogs with Quotas

6. Standardizing, Sharing, and Synchronizing Resources

    1. Centralize Resources Using NFS
    1. Automount NFS Home Directories with autofs
    1. Keep Filesystems Handy, but Out of Your Way
    1. Synchronize root Environments with rsync
    1. Share Files Across Platforms Using Samba
    1. Quick and Dirty NAS
    1. Share Files and Directories over the Web

7. Security

    1. Increase Security by Disabling Unnecessary Services
    1. Allow or Deny Access by IP Address
    1. Detect Network Intruders with snort
    1. Tame Tripwire
    1. Verify Fileystem Integrity with Afick
    1. Check for Rootkits and Other Attacks (chkrootkit)

8. Troubleshooting and Performance

    1. Find Resource Hogs with Standard Commands
    1. Reduce Restart Times with Journaling Filesystems
    1. Grok and Optimize Your System with sysctl
    1. Get the Big Picture with Multiple Displays
    1. Maximize Resources with a Minimalist Window Manager (Fluxbox)
    1. Profile Your Systems Using /proc
    1. Kill Processes the Right Way
    1. Use a Serial Console for Centralized Access to Your Systems
    1. Clean Up NIS After Users Depart

9. Logfiles and Monitoring

    1. Avoid Catastrophic Disk Failure
    1. Monitor Network Traffic with MRTG
    1. Keep a Constant Watch on Hosts
    1. Remotely Monitor and Configure a Variety of Networked Equipment
    1. Force Standalone Apps to Use syslog
    1. Monitor Your Logfiles (log-guardian, logcheck)
    1. Send Log Messages to Your Jabber Client
    1. Monitor Service Availability with Zabbix
    1. Fine-Tune the syslog Daemon
    1. Centralize System Logs Securely (stunnel, syslog-ng)
    1. Keep Tabs on Systems and Services (Nagios)

10. System Rescue, Recovery, and Repair

    1. Resolve Common Boot and Startup Problems (BIOS, runlevel)
    1. Rescue Me! (rescue disk)
    1. Bypass the Standard Init Sequence for Quick Repairs
    1. Find Out Why You Can’t Unmount a Partition
    1. Recover Lost Partitions
    1. Recover Data from Crashed Disks
    1. Repair and Recover ReiserFS Filesystems
    1. Piece Together Data from the lost+found
    1. Recover Deleted Files
    1. Permanently Delete Files (shred)
    1. Permanently Erase Hard Disks (shred, Darik’s Boot and Nuke)
    1. Recover Lost Files and Perform Forensic Analysis (The Sleuth Kit, Autopsy)

Getting the Source

Volume 1 examples are available form the O’Reilly git server:

$ git clone https://resources.oreilly.com/examples/9780596004613.git example_source/vol1

It seems there is no published example code for volume 2.

Credits and References

About LCK#148 infrastructurelinuxbook
Project Source on GitHub Return to the Project Catalog

This page is a web-friendly rendering of my project notes shared in the LittleCodingKata GitHub repository.

LittleCodingKata is my collection of programming exercises, research and code toys broadly spanning things that relate to programming and software development (languages, frameworks and tools).

These range from the trivial to the complex and serious. Many are inspired by existing work and I'll note credits and references where applicable. The focus is quite scattered, as I variously work on things new and important in the moment, or go back to revisit things from the past.

This is primarily a personal collection for my own edification and learning, but anyone who stumbles by is welcome to borrow, steal or reference the work here. And if you spot errors or issues I'd really appreciate some feedback - create an issue, send me an email or even send a pull-request.