FreeBSD Handbook

The FreeBSD Documentation Project

Welcome to FreeBSD! This handbook covers the installation and day to day use of FreeBSD 5.5-RELEASE and FreeBSD 6.1-RELEASE. This manual is a work in progress and is the work of many individuals. Many sections do not yet exist and some of those that do exist need to be updated. If you are interested in helping with this project, send email to the FreeBSD documentation project mailing list. The latest version of this document is always available from the FreeBSD web site (previous versions of this handbook can be obtained from It may also be downloaded in a variety of formats and compression options from the FreeBSD FTP server or one of the numerous mirror sites. If you would prefer to have a hard copy of the handbook, you can purchase one at the FreeBSD Mall. You may also want to search the handbook.

Table of Contents
I. Getting Started
1 Introduction
1.1 Synopsis
1.2 Welcome to FreeBSD!
1.3 About the FreeBSD Project
2 Installing FreeBSD
2.1 Synopsis
2.2 Pre-installation Tasks
2.3 Starting the Installation
2.4 Introducing Sysinstall
2.5 Allocating Disk Space
2.6 Choosing What to Install
2.7 Choosing Your Installation Media
2.8 Committing to the Installation
2.9 Post-installation
2.10 Supported Hardware
2.11 Troubleshooting
2.12 Advanced Installation Guide
2.13 Preparing Your Own Installation Media
3 UNIX Basics
3.1 Synopsis
3.2 Virtual Consoles and Terminals
3.3 Permissions
3.4 Directory Structure
3.5 Disk Organization
3.6 Mounting and Unmounting File Systems
3.7 Processes
3.8 Daemons, Signals, and Killing Processes
3.9 Shells
3.10 Text Editors
3.11 Devices and Device Nodes
3.12 Binary Formats
3.13 For More Information
4 Installing Applications: Packages and Ports
4.1 Synopsis
4.2 Overview of Software Installation
4.3 Finding Your Application
4.4 Using the Packages System
4.5 Using the Ports Collection
4.6 Post-installation Activities
4.7 Dealing with Broken Ports
5 The X Window System
5.1 Synopsis
5.2 Understanding X
5.3 Installing X11
5.4 X11 Configuration
5.5 Using Fonts in X11
5.6 The X Display Manager
5.7 Desktop Environments
II. Common Tasks
6 Desktop Applications
6.1 Synopsis
6.2 Browsers
6.3 Productivity
6.4 Document Viewers
6.5 Finance
6.6 Summary
7 Multimedia
7.1 Synopsis
7.2 Setting Up the Sound Card
7.3 MP3 Audio
7.4 Video Playback
7.5 Setting Up TV Cards
7.6 Image Scanners
8 Configuring the FreeBSD Kernel
8.1 Synopsis
8.2 Why Build a Custom Kernel?
8.3 Building and Installing a Custom Kernel
8.4 The Configuration File
8.5 If Something Goes Wrong
9 Printing
9.1 Synopsis
9.2 Introduction
9.3 Basic Setup
9.4 Advanced Printer Setup
9.5 Using Printers
9.6 Alternatives to the Standard Spooler
9.7 Troubleshooting
10 Linux Binary Compatibility
10.1 Synopsis
10.2 Installation
10.3 Installing Mathematica®
10.4 Installing Maple
10.5 Installing MATLAB®
10.6 Installing Oracle®
10.7 Installing SAP® R/3®
10.8 Advanced Topics
III. System Administration
11 Configuration and Tuning
11.1 Synopsis
11.2 Initial Configuration
11.3 Core Configuration
11.4 Application Configuration
11.5 Starting Services
11.6 Configuring the cron Utility
11.7 Using rc under FreeBSD 5.X and newer
11.8 Setting Up Network Interface Cards
11.9 Virtual Hosts
11.10 Configuration Files
11.11 Tuning with sysctl
11.12 Tuning Disks
11.13 Tuning Kernel Limits
11.14 Adding Swap Space
11.15 Power and Resource Management
11.16 Using and Debugging FreeBSD ACPI
12 The FreeBSD Booting Process
12.1 Synopsis
12.2 The Booting Problem
12.3 The Boot Manager and Boot Stages
12.4 Kernel Interaction During Boot
12.5 Device Hints
12.6 Init: Process Control Initialization
12.7 Shutdown Sequence
13 Users and Basic Account Management
13.1 Synopsis
13.2 Introduction
13.3 The Superuser Account
13.4 System Accounts
13.5 User Accounts
13.6 Modifying Accounts
13.7 Limiting Users
13.8 Groups
14 Security
14.1 Synopsis
14.2 Introduction
14.3 Securing FreeBSD
14.4 DES, MD5, and Crypt
14.5 One-time Passwords
14.6 TCP Wrappers
14.7 KerberosIV
14.8 Kerberos5
14.9 OpenSSL
14.10 VPN over IPsec
14.11 OpenSSH
14.12 File System Access Control Lists
14.13 Monitoring Third Party Security Issues
14.14 FreeBSD Security Advisories
14.15 Process Accounting
15 Mandatory Access Control
15.1 Synopsis
15.2 Key Terms in this Chapter
15.3 Explanation of MAC
15.4 Understanding MAC Labels
15.5 Planning the Security Configuration
15.6 Module Configuration
15.7 The MAC bsdextended Module
15.8 The MAC ifoff Module
15.9 The MAC portacl Module
15.10 The MAC partition Module
15.11 The MAC Multi-Level Security Module
15.12 The MAC Biba Module
15.13 The MAC LOMAC Module
15.14 Nagios in a MAC Jail
15.15 User Lock Down
15.16 Troubleshooting the MAC Framework
16 Security Event Auditing
16.1 Synopsis
16.2 Key Terms - Words to Know
16.3 Installing Audit Support
16.4 Audit Configuration
16.5 Event Audit Administration
17 Storage
17.1 Synopsis
17.2 Device Names
17.3 Adding Disks
17.4 RAID
17.5 USB Storage Devices
17.6 Creating and Using Optical Media (CDs)
17.7 Creating and Using Optical Media (DVDs)
17.8 Creating and Using Floppy Disks
17.9 Creating and Using Data Tapes
17.10 Backups to Floppies
17.11 Backup Strategies
17.12 Backup Basics
17.13 Network, Memory, and File-Backed File Systems
17.14 File System Snapshots
17.15 File System Quotas
17.16 Encrypting Disk Partitions
17.17 Encrypting Swap Space
18 GEOM: Modular Disk Transformation Framework
18.1 Synopsis
18.2 GEOM Introduction
18.3 RAID0 - Striping
18.4 RAID1 - Mirroring
19 The Vinum Volume Manager
19.1 Synopsis
19.2 Disks Are Too Small
19.3 Access Bottlenecks
19.4 Data Integrity
19.5 Vinum Objects
19.6 Some Examples
19.7 Object Naming
19.8 Configuring Vinum
19.9 Using Vinum for the Root Filesystem
20 Localization - I18N/L10N Usage and Setup
20.1 Synopsis
20.2 The Basics
20.3 Using Localization
20.4 Compiling I18N Programs
20.5 Localizing FreeBSD to Specific Languages
21 The Cutting Edge
21.1 Synopsis
21.3 Synchronizing Your Source
21.4 Rebuilding “world”
21.5 Tracking for Multiple Machines
IV. Network Communication
22 Serial Communications
22.1 Synopsis
22.2 Introduction
22.3 Terminals
22.4 Dial-in Service
22.5 Dial-out Service
22.6 Setting Up the Serial Console
23 PPP and SLIP
23.1 Synopsis
23.2 Using User PPP
23.3 Using Kernel PPP
23.4 Troubleshooting PPP Connections
23.5 Using PPP over Ethernet (PPPoE)
23.6 Using PPP over ATM (PPPoA)
23.7 Using SLIP
24 Electronic Mail
24.1 Synopsis
24.2 Using Electronic Mail
24.3 sendmail Configuration
24.4 Changing Your Mail Transfer Agent
24.5 Troubleshooting
24.6 Advanced Topics
24.7 SMTP with UUCP
24.8 Setting Up to Send Only
24.9 Using Mail with a Dialup Connection
24.10 SMTP Authentication
24.11 Mail User Agents
24.12 Using fetchmail
24.13 Using procmail
25 Network Servers
25.1 Synopsis
25.2 The inetd “Super-Server”
25.3 Network File System (NFS)
25.4 Network Information System (NIS/YP)
25.5 Automatic Network Configuration (DHCP)
25.6 Domain Name System (DNS)
25.7 Apache HTTP Server
25.8 File Transfer Protocol (FTP)
25.9 File and Print Services for Microsoft® Windows® clients (Samba)
25.10 Clock Synchronization with NTP
26 Firewalls
26.1 Introduction
26.2 Firewall Concepts
26.3 Firewall Packages
26.4 The OpenBSD Packet Filter (PF) and ALTQ
26.5 The IPFILTER (IPF) Firewall
26.6 IPFW
27 Advanced Networking
27.1 Synopsis
27.2 Gateways and Routes
27.3 Wireless Networking
27.4 Bluetooth
27.5 Bridging
27.6 Diskless Operation
27.7 ISDN
27.8 Network Address Translation
27.9 Parallel Line IP (PLIP)
27.10 IPv6
27.11 Asynchronous Transfer Mode (ATM)
V. Appendices
A. Obtaining FreeBSD
A.1 CDROM and DVD Publishers
A.2 FTP Sites
A.3 Anonymous CVS
A.4 Using CTM
A.5 Using CVSup
A.6 Using Portsnap
A.7 CVS Tags
A.8 AFS Sites
A.9 rsync Sites
B. Bibliography
B.1 Books & Magazines Specific to FreeBSD
B.2 Users' Guides
B.3 Administrators' Guides
B.4 Programmers' Guides
B.5 Operating System Internals
B.6 Security Reference
B.7 Hardware Reference
B.8 UNIX® History
B.9 Magazines and Journals
C. Resources on the Internet
C.1 Mailing Lists
C.2 Usenet Newsgroups
C.3 World Wide Web Servers
C.4 Email Addresses
C.5 Shell Accounts
D. PGP Keys
D.1 Officers
D.2 Core Team Members
D.3 Developers
FreeBSD Glossary
List of Tables
2-1. Sample Device Inventory
2-2. Partition Layout for First Disk
2-3. Partition Layout for Subsequent Disks
2-4. Possible Security Profiles
2-5. FreeBSD 4.X ISO Image Names and Meanings
2-6. FreeBSD 5.X ISO Image Names and Meanings
3-1. Disk Device Codes
17-1. Physical Disk Naming Conventions
19-1. Vinum Plex Organizations
22-1. DB-25 to DB-25 Null-Modem Cable
22-2. DB-9 to DB-9 Null-Modem Cable
22-3. DB-9 to DB-25 Null-Modem Cable
22-4. Signal Names
27-1. Wiring a Parallel Cable for Networking
27-2. Reserved IPv6 addresses
List of Figures
2-1. Typical Device Probe Results
2-2. Select Sysinstall Exit
2-3. Selecting Usage from Sysinstall Main Menu
2-4. Selecting Documentation Menu
2-5. Sysinstall Documentation Menu
2-6. Sysinstall Main Menu
2-7. Sysinstall Keymap Menu
2-8. Sysinstall Main Menu
2-9. Sysinstall Options
2-10. Begin Standard Installation
2-11. Select Drive for FDisk
2-12. Typical Fdisk Partitions before Editing
2-13. Fdisk Partition Using Entire Disk
2-14. Sysinstall Boot Manager Menu
2-15. Exit Select Drive
2-16. Sysinstall Disklabel Editor
2-17. Sysinstall Disklabel Editor with Auto Defaults
2-18. Free Space for Root Partition
2-19. Edit Root Partition Size
2-20. Choose the Root Partition Type
2-21. Choose the Root Mount Point
2-22. Sysinstall Disklabel Editor
2-23. Choose Distributions
2-24. Confirm Distributions
2-25. Choose Installation Media
2-26. Selecting an Ethernet Device
2-27. Set Network Configuration for ed0
2-28. Editing inetd.conf
2-29. Default Anonymous FTP Configuration
2-30. Edit the FTP Welcome Message
2-31. Editing exports
2-32. Security Profile Options
2-33. System Console Configuration Options
2-34. Screen Saver Options
2-35. Screen Saver Timeout
2-36. System Console Configuration Exit
2-37. Select Your Region
2-38. Select Your Country
2-39. Select Your Time Zone
2-40. Select Mouse Protocol Type
2-41. Set Mouse Protocol
2-42. Configure Mouse Port
2-43. Setting the Mouse Port
2-44. Enable the Mouse Daemon
2-45. Test the Mouse Daemon
2-46. Network Configuration Upper-level
2-47. Select a default MTA
2-48. Ntpdate Configuration
2-49. Network Configuration Lower-level
2-50. Select Configuration Method Menu
2-51. Select Default Desktop
2-52. Select Package Category
2-53. Select Packages
2-54. Install Packages
2-55. Confirm Package Installation
2-56. Select User
2-57. Add User Information
2-58. Exit User and Group Management
2-59. Exit Install
19-1. Concatenated Organization
19-2. Striped Organization
19-3. RAID-5 Organization
19-4. A Simple Vinum Volume
19-5. A Mirrored Vinum Volume
19-6. A Striped Vinum Volume
19-7. A Mirrored, Striped Vinum Volume
List of Examples
2-1. Using an Existing Partition Unchanged
2-2. Shrinking an Existing Partition
3-1. Sample Disk, Slice, and Partition Names
3-2. Conceptual Model of a Disk
4-1. Downloading a Package Manually and Installing It Locally
11-1. Creating a Swapfile on FreeBSD
12-1. boot0 Screenshot
12-2. boot2 Screenshot
12-3. An Insecure Console in /etc/ttys
13-1. Adding a user on FreeBSD
13-2. rmuser Interactive Account Removal
13-3. Interactive chpass by Superuser
13-4. Interactive chpass by Normal User
13-5. Changing Your Password
13-6. Changing Another User's Password as the Superuser
13-7. Adding a Group Using pw(8)
13-8. Adding Somebody to a Group Using pw(8)
13-9. Using id(1) to Determine Group Membership
14-1. Using SSH to Create a Secure Tunnel for SMTP
17-1. Using dump over ssh
17-2. Using dump over ssh with RSH set
17-3. A Script for Creating a Bootable Floppy
17-4. Using mdconfig to Mount an Existing File System Image
17-5. Creating a New File-Backed Disk with mdconfig
17-6. Configure and Mount a File-Backed Disk with mdmfs
17-7. Creating a New Memory-Based Disk with mdconfig
17-8. Creating a New Memory-Based Disk with mdmfs
22-1. Adding Terminal Entries to /etc/ttys
24-1. Configuring the sendmail Access Database
24-2. Mail Aliases
24-3. Example Virtual Domain Mail Map
25-1. Reloading the inetd configuration file
25-2. Mounting an Export with amd
27-1. Branch Office or Home Network
27-2. Head Office or Other LAN
A-1. Checking Out Something from -CURRENT (ls(1)):
A-2. Using SSH to check out the src/ tree:
A-3. Checking Out the Version of ls(1) in the 6-STABLE Branch:
A-4. Creating a List of Changes (as Unified Diffs) to ls(1)
A-5. Finding Out What Other Module Names Can Be Used:

This, and other documents, can be downloaded from

For questions about FreeBSD, read the documentation before contacting <[email protected]>.
For questions about this documentation, e-mail <[email protected]>.