Ñïàñèáî, ÷òî ñêà÷àëè êíèãó â áåñïëàòíîé ýëåêòðîííîé áèáëèîòåêå BooksCafe.Net
Âñå êíèãè àâòîðà
Ýòà æå êíèãà â äðóãèõ ôîðìàòàõ
Ïðèÿòíîãî ÷òåíèÿ!
- Introduction
- PART I
- CHAPTER 1
- CHAPTER 2
- CHAPTER 3
- CHAPTER 4
- Understanding the Command Line
- Navigating Through the File System
- Managing Files with the Shell
- Working with Compressed Files
- Use Essential Commands from the /bin and /sbin Directories
- Use and Edit Files in the /etc Directory
- Protect the Contents of User Directories — /home
- Use the Contents of the /proc Directory to Interact with the Kernel
- Work with Shared Data in the /usr Directory
- Temporary File Storage in the /tmp Directory
- Access Variable Data Files in the /var Directory
- Logging In to and Working with Linux
- Using the Text Editors
- Working As Root
- Reading Documentation
- Reference
- PART II
- CHAPTER 5
- CHAPTER 6
- CHAPTER 7
- CHAPTER 8
- CHAPTER 9
- PART III
- CHAPTER 10
- CHAPTER 11
- Running Services at Bootup
- Beginning the Boot Loading Process
- Loading the Linux Kernel
- System Services and Runlevels
- Runlevel Definitions
- Booting into the Default Runlevel
- Booting to a Nondefault Runlevel with GRUB
- Understanding init Scripts and the Final Stage of Initialization
- Controlling Services at Boot with Administrative Tools
- Running Services Through xinetd
- Changing Runlevels
- Troubleshooting Runlevel Problems
- Starting and Stopping Services Manually
- Scheduling Tasks
- Basic Shell Control
- Reference
- CHAPTER 12
- CHAPTER 13
- CHAPTER 14
- CHAPTER 15
- CHAPTER 16
- PART IV
- CHAPTER 17
- CHAPTER 18
- CHAPTER 19
- CHAPTER 20
- Choosing an FTP Server
- Installing FTP Software
- The FTP User
- xinetd Configuration for wu-ftpd
- Configuring the Very Secure FTP Server
- Configuring the wu-ftpd Server
- Using Commands in the ftpaccess File to Configure wu-ftpd
- Configuring FTP Server File-Conversion Actions
- Using ftphosts to Allow or Deny FTP Server Connection
- Using Commands for Server Administration
- Reference
- CHAPTER 21
- CHAPTER 22
- CHAPTER 23
- CHAPTER 24
- PART V
- CHAPTER 25
- CHAPTER 26
- CHAPTER 27
- CHAPTER 28
- CHAPTER 29
- PART VI
- CHAPTER 30
- CHAPTER 31
- CHAPTER 32
- Why Use the Shell?
- Basic Commands
- Printing the Contents of a File with cat
- Changing Directories with cd
- Changing File Access Permissions with chmod
- Copying Files with cp
- Printing Disk Use with du
- Finding Files by Searching with find
- Searches for a String in Input with grep
- Paging Through Output with less
- Creating Links Between Files with ln
- Finding Files from an Index with locate
- Listing Files in the Current Directory with ls
- Reading Manual Pages with man
- Making Directories with mkdir
- Moving Files with mv
- Listing Processes with ps
- Deleting Files and Directories with rm
- Printing the Last Lines of a File with tail
- Printing Resource Usage with top
- Printing the Location of a Command with which
- Combining Commands
- Multiple Terminals
- Date and Time
- Capturing Screen Images
- Reference
- CHAPTER 33
- Running a Shell Program
- Interpreting Shell Scripts Through Specific Shells
- Using Variables in Shell Scripts
- Using a Simple Script to Automate Tasks
- Built-In Variables
- Special Characters
- Comparison of Expressions in bash
- Special Statements: for, while, and Others
- Using Functions in Shell Scripts
- Reference
- CHAPTER 34
- CHAPTER 35
- CHAPTER 36
- PART VII
- APPENDIX A
- APPENDIX B
- APPENDIX C
- Websites and Search Engines
- Web Search Tips
- Google Is Your Friend
- Fedora Package Listings
- Certification
- Commercial Support
- Documentation
- Linux Guides
- The Fedora Project
- Red Hat Linux
- Mini-CD Linux Distributions
- Floppy-Based Linux Distributions
- Various Intel-Based Linux Distributions
- PowerPC-Based Linux Distributions
- Linux on Laptops and PDAs
- X
- Usenet Newsgroups
- Mailing Lists
- Internet Relay Chat
- Ñíîñêè
Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message.When you write, please be sure to include this book's title and author as well as your name and phone or email address. I will carefully review your comments and share them with the author and editors who worked on the book.
A lot of documentation is included with every Linux distribution, and Fedora is certainly no exception. Although the intent of Fedora Unleashed is to be as complete as possible, it is impossible to cover every option of every command included in the distribution. However, this book offers numerous tables of various options, commands, or keystrokes to help condense, organize, and present information about a variety of subjects.Conventions Used in This Book
NOTE
A note provides additional information you might want to make note of as you are working, augment a discussion with ancillary details, or point you to an article, a whitepaper, or another online reference for more information about a specific topic.
TIP
A tip can contain special insight or a timesaving technique, as well as information about items of particular interest to you that you might not find elsewhere.
CAUTION
A caution warns you about pitfalls or problems before you run a command, edit a configuration file, or choose a setting when administering your system.
Other formatting techniques used to increase readability include the use of italics for placeholders in computer command syntax. Computer terms or concepts also are italicized upon first introduction in text.Sidebars Can Be Goldmines
Just because it is in a sidebar does not mean that you will not find something new here. Be sure to watch for these elements that bring in outside content that is an aside to the discussion in the text. You will read about other technologies, Linux-based hardware, or special procedures to make your system more robust and efficient.
Live CDs
If you've not come across Live CDs, you might be a bit unsure as to what they are. Basically, a Live CD is a single CD that enables you to boot into a fully functional operating system, in this case Fedora. The Live CD stores all the system files on the CD in a compressed format, uncompressing parts of the operating system as needed. The upshot of this is that you can give Fedora a try without having to repartition or otherwise modify your hard drive.
More important, however, the Live CD enables you to test your hardware to make sure that it is compatible with Fedora. When you are happy, you can use the Live CD to give you a base Fedora installation. Just double-click the Install icon on the desktop and follow the installation instructions found later in this chapter. For now, download and burn the Live CD ISO file to a blank CD using your favorite CD-burning application — it will come in handy later!
Typically, Fedora creates three partitions on your drive: a /boot partition that stores information to help Fedora boot up, a /partition (or root partition) that stores the bulk of your information, and a swap partition that Fedora uses to temporarily store information when your RAM is full. For the majority of people this is fine, and many users go ahead and use the default partition options. However, there may be occasions when you want to store your /home? directory (which contains your user settings and documents) on a separate partition. This might be the case if you plan on upgrading your distribution fairly often and don't want to lose settings unique to you. You should be mindful of not only the current business requirements, but also any anticipated requirements, especially if you are in a growing company. It can be very painful when you are running out of storage space because you underestimated storage or partitioning requirements.What Is a Partition?
It can be difficult to explain to new users about partitions. A useful analogy is of a kitchen, in which there are many different drawers and cupboards. Imagine the kitchen is your hard drive, and the drawers and cupboards are partitions. In one cupboard, you may keep cups, another might hold ingredients, yet another may hold pots and pans. They are all part of the kitchen but have specific roles within the kitchen.
Taking this back to your hard drive, you may have a partition to hold your user information, another partition to hold the files you will use for serving web pages, and another for boot information.
DVD Installation Jump-Start
To install Fedora from the DVD included with this book, you must have at least a Pentium-class CPU, 800MB hard drive, and 128MB RAM. You need at least 192MB to install with Fedora's graphical installer. A 10GB hard drive can easily host the entire distribution, leaving about 3GB free for other data. Most modern systems have significantly larger drives, but it is still a good idea to invest in more storage from your local computer store.
To begin the installation, you need to get into your computer's BIOS to set the boot sequence so that the CD/DVD drive is the first drive that is booted. Insert the DVD into the drive and let the system boot. When the boot: prompt appears, press the Enter key and follow through the various dialog boxes to install Fedora.
Make sure that you make a note (mental or otherwise) of the root password because you will need it later. When the installer is finished, the DVD ejects and you are asked to reboot the computer. A few more dialog boxes appear to allow you to do some more initial configuration of the system before you are greeted with a login prompt. Make sure to log in as the user you created during the installation and not as root. Finally, finish the install, remove the DVD from your computer, and reboot. Then log in and enjoy Fedora!
To install from an FTP location, select the network IP address assignment for your target PC, such as DHCP, or manually enter an IP address along with optional gateway IPTIP
Just press Enter at the boot prompt if you boot to a network install by using a CD-R created with the boot.iso image. You will boot a graphical network install.
NOTE
See Chapter 20 for details on how to configure the vsftpd FTP server. Chapter 17 provides information on how to set up and configure Apache for web service. See Chapter 19, "File and Print," for Samba settings. Note that you can have your server perform all three duties.
This example installation prepares a computer for general duties as a desktop workstation, giving you access to office productivity applications and Internet applications.NOTE
If you are using the Live CD, we assume that you have double-clicked the Install icon on the desktop. Pick up the instructions below at the Release Notes point.
Before you begin, ensure that your computer is not connected to the Internet. Although you can use the installer to set up network protection during the install, it is best to check your system settings after any install and before opening up any public services (see the section "Firstboot Configuration" later in this chapter).CAUTION
If you are wanting to dual boot with Windows, make sure you have prepared your partitions, using the instructions detailed earlier.
TIP
If you are installing to a system that has an older display monitor, it is a good idea to have your monitor's manual handy during the installation. If the install does not detect your monitor settings, you might need to specify the monitor's vertical and horizontal frequencies. This does not happen often, but if it does, you will be prepared.
After you press Enter, the installer's kernel loads, and you're asked (in a text-based screen) whether you would like to perform a media check of your installation media, as shown in Figure 1.7.TIP
The installer starts automatically in 60 seconds. Press the spacebar, reboot, or turn off your PC if you need to halt the install.
If your pointing device (mouse) is not recognized, you can press Alt+R to "press" the Release Notes button. Similarly, you can press Alt+H to hide text shown on the left side of the screen, but you should take a minute to read the frame's contents.NOTE
Fedora's installer supports the capability to monitor background and install processes running during an installation. You can watch the progress of an install and hardware information reported by the Linux install kernel by navigating to a different console display or virtual console. To do so, simultaneously press the Ctrl, Alt, and the appropriate function key (such as F1-F5).
Use this approach to watch for kernel messages, monitor hardware detection, gain access to a single-user shell, and view the progress of the installer script.
When using a graphical installer, press Ctrl+Alt+F4 (then Alt+F2 or Alt+F3) to navigate to the various screens. Press Alt+F7 to jump back to the installer. When performing a text-based installation, use Alt+F2 (then Alt+F3 or Alt+F4). Use Alt+F1 to jump back to a text-based install.
If you choose one of these three, you get a default layout that uses logical volume management. This is a special type of partitioning that makes disk partitions much easier to work with.NOTE
If you followed the earlier partitioning instructions, choose to Use Free Space on Selected Drives and Create Default Layout.
This example looks at creating a partition table on one hard drive. To get started, click the New button to bring up the screen shown in Figure 1.13. First of all, you need to create a small partition that has the mount point /boot. This is to enable Fedora to actually boot and needs to be a maximum of only about 100MB in size. Make sure that only the first disk is checked (sda in the example) and select /boot from the drop-down mount point menu. Finally, change the size of the partition to 100MB and click the OK button to create the first partition.Logical Volume Management for Beginners
Logical volume management sounds a lot more difficult than it is. In effect, what it does is allow you to produce single logical partitions that can be made up of multiple physical drives. Logical volumes can also be resized as required, something that is usually difficult when dealing with ext3 partitions (Fedora's native partition type). There is one thing that you need to remember: Create a separate /boot partition independent of the logical volumes; otherwise, your system will not boot!
Select the GRUB boot loader. GRUB is typically installed in the MBR of the first IDE hard drive in a PC. However, the boot loader can also be installed in the first sector of the Linux boot partition, or even not installed on the hard drive. Note that you can also backtrack through the install process to change any settings.TIP
Fedora works well with other operating systems, but the reverse is not always true. If you need specialized help with configuring a dual-boot system, check various HOWTOs at http://www.tldp.org for hints and tips.
If you click the Configure Advanced Boot Loader Options button, you are asked for arguments to pass to the Linux kernel before booting. Kernel arguments are used to enable or disable various features of Linux at boot time. If you install the source to the Linux kernel, you can find documentation about the more than 200 different kernel arguments in the file kernel-parameters.txt under the /usr/src/linux/Documentation directory.NOTE
If you are planning to dual boot your PC with Windows, it appears in the list of boot options as Other. You can click the Edit button to access options that enable you to rename it something a little more informative, or even set Windows as the default option for GRUB.
You can choose to have your interface information automatically set with DHCP. Otherwise, especially if you are configuring a DHCP server, manually enter an IP address, hostname, or gateway address (such as for a router), along with DNS information if you click the Edit button listed by the interface (such as eth0 in the example). After making your selection, click Next to continue.NOTE
If the Linux kernel finds more than one network interface installed on your computer, you might be asked to configure a second ethernet device. This might be the case, for example, if you are installing Fedora on a computer that serves as a gateway or fire wall. If you configure more than one ethernet device, the device named eth0 is the first active interface when you start Fedora.
Choose your time configuration, and then click Next.TIP
Read the man page for the hwclock command to learn how to keep a running Linux system synchronized with a PC's hardware clock.
When finished, click Next to continue with software package selection for your new server.CAUTION
Do not forget your system's BIOS, boot loader, or root passwords! Some equipment, such as notebook computers, might require factory replacement of motherboard components if the owner forgets the BIOS password. The BIOS settings on most desktop PCs can usually be reset via a jumper or removal and insertion of the motherboard battery. If you forget your boot loader password, use a boot disk (perhaps created during installation as shown later on in this chapter) or boot to a rescue mode by using your Fedora disc and reset the root password, using the passwd command.
NOTE
You can create a root account only during a Fedora install. You will have to create user accounts after booting, using a command-line program (such as adduser) or the graphical system-config-users client. Create an account for yourself and any additional users. Usernames traditionally consist of the first letter of a person's first name and then the last name. For example, Tom Denning would have a username of tdenning. Do not forget to enter a password for any new user! If you create a user without a creating a password, the new user will not be able to log in.
You should create at least one user for your server in addition to the root operator. This is for security purposes and to avoid logging in as root, either through the keyboard at the server or remotely over the network. The default shell and home directory settings should remain set at the defaults, which are the Bourne Again SHell (bash) and the /home directory.
See Chapter 4, "Command-Line Quick Start," for how to become the root user or run root commands as a regular user. See Chapter 10 for details on managing users.
TIP
Good passwords are essential for system security. However, some people still rely on passwords as simple as admin. This is asking for trouble, and we would encourage you to create a strong password made up of letters, numbers, and even punctuation. It can be difficult to create a password that is easily memorable and that includes punctuation, but it can be simpler than you think. For instance, George Nedeff may want to use his full name as a password, but that would be easy to crack. What he could do is use punctuation and numbers to replace similar letters in his name, such as G30rg3n3defF. This is a very strong password, and not easily broken, but at the same time it is very easy to remember.
What Happened to Install Everything?
In previous versions of Fedora and Red Hat Linux, there was an option to install every thing available. This has now been removed from Fedora for a number of reasons. First of all, installing all the packages can create dependency nightmares when upgrading and installing new packages. Second, there can be too many packages for new users to handle. Third, and perhaps most important, it can pose a huge security risk to your system. The more software you have installed, the greater the risk that someone could find a vulnerable entry point into your system.
You are also able to specify whether you want to customize your package selection further by selecting the Customize Now button and clicking Next to go to Figure 1.22. Otherwise, just click Next to land at the final screen.NOTE
Fedora can enter your own repositories at install time. Fedora takes these new repositories into account when you go through the Customize Packages screens. All you have to do is provide a name for the repository, as well as the FTP or HTTP server and path details to the repomd.xml file. Just click the Add Repository button to do this.
NOTE
After installation, you can edit the file /boot/grub/grub.conf and change the timeout= setting to change the boot time to a value other than 5 seconds.
Firewall configuration is up next (see Figure 1.26), and you should always have your fire wall enabled. Sensibly, Fedora defaults to this, but it also asks you whether you want to allow access to specific ports to allow services to run. Depending on your requirements, you might want to select one or more of the boxes. You can also enter in specific ports and the protocol (TCP or UDP), although you should be aware that the more services or ports you allow access to, the less secure your system becomes as it opens up more opportunities for attack.NOTE
To read the end-user licensing agreement for Fedora, go to http://fedoraproject.org/wiki/Legal/Licenses/EULA.
You are able to choose how SELinux is implemented on your system, but unless you have a specific reason to change any of the default settings, just click the Next button to continue. The default settings provide a very secure system.SELinux
As mentioned earlier, SELinux came from the NSA (National Security Agency), one of the most secret organizations in the United States. The community's shock at having this technology released to them can be summed up by Larry Loeb when he said, "Let me assure you that this action by the NSA was the crypto-equivalent of the pope coming down off the balcony in Rome, working the crowd with a few loaves of bread and some fish, and then inviting everyone to come over to his place to watch the soccer game and have a few beers. There are some things that one just never expects to see, and the NSA handing out source code along with details of the security mechanism behind it was right up there on that list."
Apart from these three icons, a set of shortcut icons is immediately to the right of the System menu; these represent five useful applications you may want to access quickly. You'll also see the clock farther along the top panel, as well as a Speaker icon representing the sound options. You may also see an icon denoting your network connection status; more on this as part of the "Configuring Wireless Networks" section.TIP
In Linux-speak, the tilde character (~) represents Home, or the folder that contains information that is specific to your login. So my home directory is called andrew's home, as this matches my login name. Your login name will differ, unless of course your name is Andrew, too!
It's useful to remember the tilde, especially when you come to the "Command-Line Quick Start" (Chapter 4) or the "Command-Line Master Class" (Chapter 32) because it will help you with navigating via the terminal.
Finally, in the bottom-right corner is the trash can, to which you can drag files to be deleted when you are ready. By default it is empty, but as you delete things, the trash can becomes full, indicating that there is something there.Workspace Switcher — A Quick Primer
Workspaces are something that you probably haven't come across in other operating systems, but you will see them a lot in Fedora and other Linux, FreeBSD, and UNIX systems. Essentially, Fedora creates four workspaces across which you can run several applications, depending on how you work. For instance, you could use work space one for your word processor, workspace two for your spreadsheet, workspace three for your email, and workspace four for your configuration tools.
Accessing each workspace is as simple as clicking it in the Workspace Switcher. Fedora immediately switches to that workspace and displays whatever applications are present. Your desktop and any icons on it remain on the workspace, ready for your use.
Alternatively, if you want to use the keyboard to switch between workspaces, you need to press Ctrl+Alt and either the left or right cursor key to move left a workspace or right a workspace. Fedora keeps you in the loop as to which workspace is currently active by highlighting it in the Workspace Switcher. You can also see small windows open within the workspaces that have active applications.
In older releases, Fedora left the home directory pretty much empty (with the exception of the personalized settings, which are hidden), but now there are seven folders to help you organize your files. You don't have to keep any of them, but they are there as a helping hand in your move to Fedora.NOTE
So we said that all your personalized settings are stored in your home directory, but when you open it up you find that you can't see anything but the default directories. This is because all your personalized settings are stored in hidden folders, commonly prefixed with a period. Simply go to the View menu and select Show Hidden Files and suddenly you'll see all the folders related to your settings.
NOTE
Fedora doesn't ship with MP3 support as standard, nor does it include support for many of the standard formats found within Windows or Mac OS X. This is down to the patents that are used in the development of these formats, more commonly known as codecs. Inclusion of these codecs in Fedora is prevented due to the legality of the licenses and patents involved. However, all is not lost. Some third-party repositories offer plug-ins for the multimedia applications bundled with Fedora, which allow them to use additional codecs.
Unfortunately it's trial and error from here in, so you will have to try each file in turn to see if it enables your hardware. For the files wl_apsta.o and wl_apsta-3.130.20.0.o, you need to use the command bcm43xx-fwcutter; for the wl_apsta_mimo.o file, you need to use b43-fwcutter. Either way, the syntax is command file. So, for example, you might enter the following:NOTE
For the broadcom-wl-4.80.53.0.tar.bz2 file, you will need to double-click it because it is a compressed file. When Archive Manager opens, browse to broadcom-wl-4.80.53.0/kmod/ and copy both wl_apsta.o and wl_apsta.mimo.o to your home directory, either by dragging both files onto your Home icon, or by clicking Extract in the toolbar and browsing to your home directory.
The Red Hat and Fedora Desktop
If you have used earlier versions of Fedora and indeed Red Hat Linux, you will be more than aware of Bluecurve and perhaps also Clearlooks. Fedora has now settled on a consistent style throughout the whole distribution and has finally done away with the slightly older-looking Bluecurve icon set in favor of the Nodoka theme. KDE, another window manager you'll learn about later, has also received some polish, and the two window managers have a consistent look and feel.
After you have verified your graphic driver situation, you will find a menu option under System, Preferences, Look and Feel, called Desktop Effects (see Figure 3.3). Open it and select the option to Enable Desktop Effects. After a couple of seconds, you may see your window decorations (title bar, minimize and maximize buttons) disappear and then reap pear. It may seem that nothing has happened, but check the box to activate Wobbly Windows and then grab hold of the window title bar and move it around. If everything has gone according to plan, it should wobble! Click Keep Settings to save the settings, and welcome to a world of fancy effects.NOTE
You might wonder why installation of graphics drivers is placed alongside information on games. For the most part, 3D acceleration is not a necessity if you are using Fedora for productivity only. However, if you are intending to work off a bit of aggression by blowing away some opponents in Unreal Tournament, you are going to need 3D acceleration enabled, and you need the specific graphics drivers for that.
Because X offers users a form of distributed processing, this means that Fedora can be used as a very cheap desktop platform for clients that connect to a powerful X server. The more powerful the X server, the larger the number of X-based clients that can be accommodated. This functionality can breathe new life into older hardware, pushing most of the graphical processing on to the server. A fast network is a must if you intend to run many X clients because X can become bandwidth-hungry.NOTE
We couldn't think of a better way to demonstrate the capability of X to handle remote clients than by using its capabilities to produce this chapter. Although the OpenOffice.org file for this chapter resided on a Mac mini (running Fedora), the display and keyboard used were actually part of an Acer Ferrari notebook running Ubuntu 6.06 LTS, via an ethernet connection. Revisions were done with the Logitech keyboard and mouse of a desktop machine running Fedora 8, again connected to the Mac mini via X, but this time using a wireless connection.
The /usr directory and its subdirectories contain the majority of Xorg's software. Some important subdirectories areNOTE
A full installation of X and related X.Org 7.3 files can consume more — usually much more — than 170MB of hard drive space. This happens because additional clients, configuration files, and graphics (such as icons) are under the /usr/bin and /usr/share directory trees. You can pare excessive disk requirements by judiciously choosing which X-related packages (such as games) to install on workstations. However, with the increased capacity of most desktop PC hard drives today, the size requirements are rarely a problem, except in configuring thin-client desktops or embedded systems.
NOTE
If you change your computer's pointing device, you should then run Fedora's system-config-mouse client, which automatically updates your system's xorg.conf file.
CAUTION
From Fedora Core 3 onward, the location for the mouse device changed from /dev/mouse to /dev/input/mice. Unfortunately, when system-config-display writes the xorg.conf file, it sometimes gets a little confused and still maps the mouse to /dev/mouse rather than /dev/input/mice. This is where a little knowledge of vi comes in handy!
NOTE
If your monitor and graphics card support multiple resolutions and the settings are properly configured, you can use the key combination of Ctrl+Alt+Keypad+ or Ctrl+Alt+Keypad to change resolutions on-the-fly during your X session.
Related Fedora and Linux Commands
You can use these commands to create and configure the X Window System in Fedora:
► Xorg — The X server that is provided with the X Window System distribution from The X.Org Foundation
► mouseconfig — Fedora's text-based GUI pointing-device configuration program
► kcontrol — The KDE Control Center client
► system-config-display — Fedora's graphical X11R7 configuration tool
► system-config-mouse — Fedora's graphical mouse configuration tool
► gdmsetup — The GNOME display manager configuration client
► startx — A shell script used to start one or more X sessions from the shell command line
► xsri — A display manager root desktop decoration client
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. Do not get too comfy; the command line in Linux is far superior to its distant MS-DOS cousin. 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-like operating systems, such as Solaris, OpenBSD, FreeBSD, and even Mac OS X (because it allows you access to a terminal).
As with most things, Fedora offers you a number of ways to access the command line. You can use the terminal entry in Applications, System Tools, but by far the simplest way is to press Ctrl+Alt+F1. Fedora switches to a black screen and a traditional login prompt that resembles the following:Security
One concept you will have to get used to is that of user-based security. By and large, only two types of users will access the system as actual users. The first type is the regular user, of which you created one when you started Fedora for the first time (see Chapter 1, "Installing Fedora"). These users can change anything that is specific to them, such as the wallpaper on the desktop, their personal preferences, and so on. These users are prevented from making changes that will affect other users than themselves, sometimes called systemwide changes.
To make systemwide changes, you need to use the super-user or root account. This is a special-access privilege that gives you complete control over the entire system, with the ability to destroy everything should you so want. If you have installed Linux on your own PC, you automatically have access to the root account as you set it up during the installation. However, it is not unusual for users to not have any access to the root user, especially in corporate environments where security and system stability are of paramount importance.
An example of the destructive nature of root can be found in the age-old example of #rm -rf /, which erases all the data on your hard drive. You need to be especially careful when working as root; otherwise, you might irreparably damage your system. Don't let this worry you, however, because the root user is fundamental to a healthy Linux system. Without it you would not be able to install new software, edit system configuration files, or do any number of administration tasks. By the end of this chapter, you will feel comfortable working as root and be able to adequately administer your system.
Fedora is waiting for you to log in as a user, so go ahead and enter your username and press the Return key. Fedora then prompts you for your password, which you should enter. Note that Fedora does not show any characters while you are typing your password in. This is a good thing because it prevents any shoulder surfers from seeing what you've typed or the length of the password.TIP
This is actually one of six virtual consoles that Fedora provides for your use. After you have accessed a virtual console, you can use the Alt key and F1 through F6 to switch to a different console. If you want to get back to the graphical interface, press 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 vt1 to vt2.
Another way to quickly access the terminal is to go to Applications, Accessories and choose the Terminal entry. Fedora opens up gnome-terminal, which allows you to access the terminal while remaining in Gnome. This time, the terminal appears as black text on a white background. You can choose to access the terminal this way, or by using the Ctrl+Alt+F1 route; either way you will get to the same place.TIP
Navigating through the system at the command line can get confusing at times, especially when a directory name occurs in several different 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 directory half a dozen times and have lost track.
Another important command to use is the ls command, which lists the contents of the current directory. It's commonly used by itself, but a number of options (or switches) available for ls give you more information. For instance, the following command returns a listing of all the files and directories within the current directory, including any hidden files (denoted by a . prefix) as well as a full listing, so it will include details such as the permissions, owner and group, size, and last modified time and date:CAUTION
Don't forget the pwd command to remind you where you are within the file system!
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 |
/initrd | Initial RAM disk boot support (used during boot time) |
/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) |
/selinux | Holds the data for SELinux, the security component of Fedora |
/sys | Real-time information on devices used by the kernel |
/tmp | Temporary files |
/usr | Secondary software file hierarchy |
/var | Variable data (such as logs); spooled files |
NOTE
Learn more about using expressions by reading the ex or grep manual pages.
CAUTION
If you are new to Linux, the system-config-keyboard client is the best tool to use to configure a keyboard. You should manually edit system hardware configuration files used by graphical management clients only as a last resort.
Other ways to use the /proc directory includeNOTE
The Linux kernel has a number of built-in protections, but good system administration security policies and a secure firewall protecting your gateway, router, or Internet-connected system are the best protection you can use. See Chapter 30, "Securing Your Machines," for an overview of firewalling and examples of how to implement network security tools included with Fedora.
NOTE
This chapter focuses on text-based logins and use of Linux. Graphical logins and using a graphical desktop are described in Chapter 3.
NOTE
Note that 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 how many characters are on your screen. It is not difficult to guess that a five-letter pass word might correspond to the user's spouse's first name!
The best and most secure way (barring future exploits) to log in to a remote Linux computer is to use the ssh or Secure Shell client. Your login and session are encrypted while you work on the remote computer. The ssh client features many different command-line options, but can be simply used with the name or IP address of the remote computer, like this:NOTE
See Chapter 14, "Networking," to see how to set up network interfaces with Linux to support remote network logins and Chapter 11 to see how to start remote access services (such as sshd).
At the command line, you can use the env or printenv commands to display these environment variables, like so:NOTE
Each shell can have its own feature set and language syntax, as well as a unique set of default environment variables. See Chapter 15, "Remote Access with SSH," for more information about using the different shells included with Fedora.
NOTE
See the bash man page for other variables you can use for prompt settings.
NOTE
Use the vimtutor command to quickly learn how to use vi's keyboard commands. The tutorial takes less than 30 minutes, and it teaches new users how to start or stop the editor; navigate files; insert and delete text; and perform search, replace, and insert operations.
The emacs editor uses an extensive set of keystroke and named commands, but you can work with it by using a basic command subset. Many of these basic commands require you to hold down the Ctrl key, or to first press a meta key (generally mapped to the Alt key). The basic commands are listed in Table 4.2.TIP
If you start emacs when using X11, the editor launches in its own floating window. To force emacs to display inside a terminal window rather than its own window (which can be useful if the window is a login at a remote computer), use the -nw command-line option like this:emacs -nw file.txt.
Action | Command |
---|---|
Abort | Ctrl+G |
Cursor left | Ctrl+B |
Cursor down | Ctrl+N |
Cursor right | Ctrl+F |
Cursor up | Ctrl+P |
Delete character | Ctrl+D |
Delete line | Ctrl+K |
Go to start of line | Ctrl+A |
Go to end of line | Ctrl+E |
Help | Ctrl+H |
Quit | Ctrl+X, Ctrl+C |
Save As | Ctrl+X, Ctrl+W |
Save file | Ctrl+X, Ctrl+S |
Search backward | Ctrl+R |
Search forward | Ctrl+S |
Start tutorial | Ctrl+H, T |
Undo | Ctrl+X, U |
TIP
One of the best reasons to learn how to use emacs is that you can use nearly all the same keystrokes to edit commands on the bash shell command line. Another reason is that like vi, emacs is universally available on nearly every UNIX and Linux system, including Apple's Mac OS X.
You can use sudo to assign specific users or groups permission to perform specific tasks (similar to BSD UNIX and its "wheel" group of users). The sudo command works by first examining the file named sudoers under the /etc directory; you modify this file with the visudo command. See the section "Granting Root Privileges on Occasion — The sudo Command" in Chapter 10, "Managing Users," for details on how to configure and use sudo.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-character text width, but this is not always the case. By default, the vi and emacs editors don't use line wrap.
Use the useradd command, along with a user's name, to quickly create a user:NOTE
In this chapter, you learn how to manage users from the command line. See Chapter 10 for more information on user administration with Fedora using graphical administration utilities, such as the system-config-users client.
TIP
Do not shut down your computer if you suspect that one or more intruders has infiltrated your system; 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. See Chapter 14 and Chapter 30, "Securing Your Machines," for how to protect and monitor a network-connected system.
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 documentation. You can use the apropos command — for example, with a keyword such as partition — to find commands related to partitioning, like this:NOTE
Checking Fedora's website for security updates and bug fixes is a good idea. Browse to http://fedoraproject.org/wiki/. Alternatively, you can always do a quick yum update to make sure that your system has the most up-to-date software available.
NOTE
Although nearly all the hundreds of GNU commands included with Linux each have a man page, you must use the info command to read detailed information about using a GNU command. For example, to learn even more about bash (which has a rather extensive manual page), use the info command like this:
$ info bash
Press the n and p keys to navigate through the document, or scroll down to a menu item on the screen and press Enter to read about a specific feature. Press q to quit reading.
Related Fedora and Linux Commands
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 under stand 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
A Brief Introduction to the Internet
The Internet itself was first brought to life by the U.S. Department of Defense in 1969. It was called ARPANet after the Department of Defense's Advanced Research Projects Agency. Designed to build a network that would withstand major catastrophe (this was the peak of the Cold War), it soon grew to encompass more and more networks to build the Internet. Then, in 1991, Tim Berners-Lee of CERN developed the idea of the World Wide Web, including Hypertext Transfer Protocol (HTTP) and Hypertext Markup Language (HTML). This gave us what we now know to be the Internet.
You must also choose between SMTP or Sendmail for sending your mail; enter your email address, and choose a time zone (very important for your calendar). Finally, you will see the opening Evolution window in Figure 5.6.TIP
If you connect to the Internet using a dialup modem, make sure you don't check the Checking for New Mail option; otherwise, you might find that you will be connecting every 10 minutes.
You can find Pidgin under Applications, Internet, listed as Internet Messenger, and it is shown in Figure 5.12.NOTE
If you have used earlier versions of Fedora, you might be wondering why we are covering Pidgin rather than GAIM. Well, GAIM had a few legal problems surrounding their use of AIM within their name, which could have led to confusion with AOL Instant Messenger. As a result, GAIM rebranded itself Pidgin instead and is included within Fedora.
NOTE
Pidgin supports Jabber, an open XML-based IM protocol that can be used to set up a corporate IM server. Jabber is not supplied with Fedora, but you can obtain additional information about it from the Jabber home page at http://www.jabber.com/. You can obtain the Jabber server, Jabberd, from http://jabberd.jabberstudio.org/. If you want to use Pidgin locally for collaboration, Jabber would be an excellent choice for a private local server.
X-Chat is a popular IRC client, and it is the client that is used in this chapter's example. The HTML documents for X-Chat are available in /usr/share/docs/xchat. It is a good idea to read them before you begin because they include an introduction to and cover some of the basics of IRC. You need to download and install X-Chat to launch the X-Chat client, select X-Chat from Applications, Internet.CAUTION
You should never use an IRC client while you are the root user. It is better to create a special user just for IRC because of potential security problems. To use X-Chat in this manner, you open a terminal window, use su to change to your IRC user, and start the X-Chat client.
After you select a channel, you can join in the conversation, which appears as onscreen text. The messages scroll down the screen as new messages appear.The Wild Side of IRC
Do not be surprised at the number of lewd topics and the use of crude language on public IRC servers. For a humorous look at the topic of IRC cursing, see http://www.irc.org/fun_docs/nocuss.html. This site also offers some tips for maintaining IRC etiquette, which is essential if you do not want to be the object of any of that profanity! Here are some of the most important IRC etiquette rules:
► Do not use colored text, all-capitalized text, blinking text, or "bells" (beeps caused by sending to a terminal).
► Show respect for others.
► Ignore people who act inappropriately.
TIP
You can establish your own IRC server even though Fedora does not provide one. Setting up a server is not a task for anyone who is not well versed in Linux or IRC. A popular server is IRCd, which you can obtain from ftp://ftp.irc.org/irc/server/. Before you download IRCd, look at the Read Me file to determine what files you need to down load and read the information athttp://www.irchelp.org/irchelp/ircd/.
A collection of articles posted in response to a common topic is called a thread. A thread can contain many articles as users post messages in response to other posted messages. Some newsreader programs allow users to track articles based on the threads to which they belong. This helps simplify the organization of articles in the newsgroup.NOTE
The format of newsgroup articles follows the strict guidelines defined in the Internet standards document Request For Comments (RFC) 1036. Each article must contain two distinct parts: header lines and a message body.
The header lines identify information about when and by whom the article was posted. The body of the message should contain only standard ASCII text characters. No binary characters or files should be posted within news articles. To get around this restriction, binary files are converted to text data, through use of either the standard UNIX uuencode program or the newer Multipurpose Internet Mail Extensions (MIME) protocol. The resulting text file is then posted to the newsgroup. Newsgroup readers can then decode the posted text file back into its original binary form.
The protocol used to transfer newsgroup articles from one host to another is Network News Transfer Protocol (NNTP), defined in RFC 975. (You can search RFCs at ftp://metalab.unc.edu/pub/docs/rfc/; look at the file rfc-index.txt.) NNTP was designed as a simple client/server protocol that enables two hosts to exchange newsgroup articles in an efficient manner.TIP
The free news server news.gmane.org makes the Red Hat and Fedora mail lists avail able via newsgroups. It is a handy way to read threaded discussions and easier than using the Fedora mail list archives.
NOTE
If you frequently use VoIP applications such as Ekiga, you will tire of repetitively typing in long IP addresses to make connections. To avoid this hassle, you can use a gatekeeper — similar in purpose to a DNS server — to translate names into IP addresses. OpenH323 Gatekeeper is one such popular gatekeeper application. It is not provided with Fedora, but you can obtain it fromhttp://www.gnugk.org/.
A productivity suite could be classed as containing two or more applications that could be used for creating documents, presentations, spreadsheets, and databases. Other applications could include email clients, calculators/ formula editors, and even illustration packages. Commonly they are all tied together by a default look and feel, which makes sticking to one particular suite much easier. Because Fedora uses OpenOffice.org as its standard office suite, we introduce you to Writer and Calc, the two most popular OpenOffice.org components. We also take a brief look at some of the other Linux-based office suites that are available.NOTE
OpenOffice.org is not 100% compatible with Microsoft Office. Why is this? Well, Microsoft is notoriously secretive about its proprietary file formats, and the only way that OpenOffice.org could ensure compatibility would be to reverse-engineer each file format, an exercise akin to taking apart a telephone to see how it works. This reverse-engineering could be classed as illegal under U.S. law, which would make OpenOffice.org somewhat of a potential hot potato if they chose this path. However, OpenOffice.org manages to maintain a very high standard of importing and exporting, so you should not experience too many problems.
Working with OpenOffice.org
For the majority of users of productivity suites, OpenOffice.org should fulfill most, if not all, of your requirements. However, the first hurdle you need to get over is not whether it can do what you require of it, but rather whether it can successfully import and export to proprietary Microsoft formats. In the main, OpenOffice.org should import and export with minimal hassle, perhaps getting a bit stuck with some of the more esoteric Office formatting. Given that most users do not go much beyond tabs, columns, and tables, this level of compatibility should suffice.
However, you are strongly advised to round up a selection of documents that could potentially fall foul of the import/export filter and test them thoroughly (of course, keeping a backup of the originals!). There is nothing worse than for a system administrator who has deployed a new productivity suite than to suddenly get users complaining that they cannot read their files. This would quickly destroy any benefits felt from the other useful functions within OpenOffice.org, and could even spell the return of proprietary formats and expensive office suites. Many users do not mind switching to OpenOffice.org, largely because the user interface closely resembles that of similar Microsoft applications. This helps to settle users into their environment and should dispel any fears they have over switching. Such similarity makes the transition to OpenOffice.org a lot easier.
Of course, just looking similar to Microsoft applications is not the only direct benefit. OpenOffice.org supports a huge array of file formats, and is capable of exporting to nearly 70 different types of documents. Such a wide variety of file formats means that you should be able to successfully use OpenOffice.org in nearly any environment.
A Brief History of OpenOffice.org
The OpenOffice.org office suite is based on a commercial suite called StarOffice. Originally developed by a German company, StarOffice was purchased by Sun Microsystems in the United States. One of the biggest complaints about the old StarOffice was that all the component applications were integrated under a StarOffice "desktop" that looked very much like a Microsoft Windows desktop, including a Start button and menus. This meant that to edit a simple document, unneeded applications had to be loaded, making the office suite slow to load, slow to run, and quite demanding on system resources.
After the purchase of StarOffice, Sun Microsystems released a large part of the StarOffice code under the GPL (GNU Public License), and development began on what has become OpenOffice.org, which is freely available under the GPL. Sun continued development on StarOffice and released a commercial version as StarOffice 6.0. The significant differences between the free and commercial versions of the software are that StarOffice provides more fonts and even more import/export file filters than OpenOffice.org (these filters cannot be provided in the GPL version because of licensing restrictions) and StarOffice provides its own relational database, Software AG's Adabas D database. The StarOffice counterpart to OpenOffice.org 2.3 is StarOffice 8.
The installation of OpenOffice.org is done on a systemwide basis, meaning that all users have access to it. However, users have to go into OpenOffice.org to configure it for their individual needs. This initial configuration happens transparently the first time you load any of the OpenOffice.org components, and might mean the application takes a little longer to load as a result. Be patient, and your desired application will appear.TIP
OpenOffice.org is constantly improving its productivity applications. You can check the OpenOffice.org website (http://www.openoffice.org/) for the latest version. The website provides a link to download the source or a precompiled version of the most current working installation files. A more current version might offer file format support that you need. Should you need a Windows-compatible version, you will also find it at the website.
OpenOffice.org is a constant work in progress, but the current release is on par with the Sun version of StarOffice 8.0. You can browse to the OpenOffice.org website to get documentation and answers to frequently asked questions and to offer feedback.TIP
Two websites provide additional information on the functionality of OpenOffice.org:
► http://lingucomponent.openoffice.org/download_dictionary.html — This site provides instructions and files for installing spelling and hyphenation dictionaries, which are not included with OpenOffice.org.
► http://sourceforge.net/projects/ooextras/ — This site provides templates, macros, and clip art, which are not provided with OpenOffice.org.
NOTE
You might be interested to know that Writer was the primary word processor chosen to write and edit this book.
TIP
Calc offers some nifty little features that you can use quickly if you need to. The handiest one in our opinion is the capability to select multiple cells and see immediately the total and average of the range. You will find these figures in the bottom-right status bar. This has saved us numerous times when we have needed to get this information quickly!
NOTE
The decision by the state of Massachusetts to standardize on PDF and OpenDocument has huge ramifications for the open source world. It is the first time that OpenDocument, an already-agreed open standard, has been specified in this way. What it means is that anyone who wants to do business with the state government must use OpenDocument-based file formats, and not the proprietary formats in use by Microsoft. Unfortunately for Microsoft, it does not have support for OpenDocument in any of its applications, making them useless to anyone wanting to work with the state government. This is despite Microsoft being a founding member of OASIS, who developed and ratified the OpenDocument standard!
Here are some of the primary components of the Gnome Office suite that are available in Fedora:The GTK Widget Set
Open source developers are always trying to make it easier for people to build applications and help in development. To this end, there are a number of widgets or toolkits that other developers can use to rapidly create and deploy GUI applications. These widgets control things such as drop-down lists, Save As dialogs, window buttons, and general look and feel. Unfortunately, whereas Windows and Apple developers have to worry about only one set of widgets each, Linux has a plethora of different widgets, including GTK+, QT, and Motif. What is worse is that these widgets are incompatible with one another, making it difficult to easily move a finished application from one widget set to another.
GTK is an acronym for GIMP Tool Kit. The GIMP (The GNU Image Manipulation Program) is a graphics application very similar to Adobe Photoshop. By using the GTK-based jargon, we save ourselves several hundred words of typing and help move along our discussion of GNOME Office. You might also see similar references to QT and Motif, as well as to other widget sets, in these chapters.
Commercial Office Suites for Linux
Several commercial office suites are available for Fedora in addition to StarOffice, already mentioned. None of these commercial suites are provided with Fedora. Of note is Hancom Office. Using the same QT widget set found in the KDE desktop, Hancom Office scores well on Microsoft file format compatibility. The suite includes a word processor, a spreadsheet presentation tool, and a graphics application. Corel produced a version of its WordPerfect Office 2000 for Linux before it discontinued the release of any new Linux products. It still offers a support page, but the software is no longer available, nor is the excellent — but whiskered — WordPerfect 8 for Linux.
Relevant Fedora Commands
The following commands give you access to productivity applications, tools, and processes in Fedora:
► oowriter — OpenOffice.org's Writer
► oocalc — OpenOffice.org's Calc
► ooimpress — OpenOffice.org's Impress
► koshell — KDE's KOffice office suite shell
► kspread — KDE's KSpread spreadsheet
► gimp — The GIMP (GNU Image Manipulation Package)
► gnumeric — A spreadsheet editor for GNOME
► planner — A project management client for GNOME
► abiword — A graphical word processor for GNOME
Getting Music into Fedora with Sound Juicer
A handy utility that is included with Fedora is Sound Juicer, found under Applications, Sound and Video. Sound Juicer automatically detects when you install a CD and attempt to retrieve the track details from the Internet. From there it will rip the CD tracks into Ogg files for storage on your filesystem. You can see Sound Juicer in action in Figure 7.4.
NOTE
The Icecast application, not provided with Fedora, is a popular streaming audio server. You can use Icecast to serve your MP3 music collection over your home LAN. You can learn more about Icecast at http://www.icecast.org/. A nice tutorial on Icecast is available athttp://www.linuxnetmag.com/en/issue4/m4icecast1.html.
After the initial configuration has finished, The GIMP's main windows and toolboxes appear. The GIMP's main window contains tools used for selecting, drawing, moving, view enlarging or reducing, airbrushing, painting, smudging, copying, filling, and selecting color. Depending on the version installed on your system, the toolbox can host more than 25 different tools.What Does Photoshop Have That Isn't in The GIMP?
Although The GIMP is powerful, it does lack two features Adobe Photoshop offers that are important to some graphics professionals.
The first of these is the capability to generate color separations for commercial press printers (CMYK for the colors cyan, magenta, yellow, and key [or black]). The GIMP uses RGB (red, green, and blue), which is great for video display, but not so great for printing presses. The second feature The GIMP lacks is the use of Pantone colors (a patented color specification) to ensure accurate color matching.
If these features are unimportant to you, The GIMP is an excellent tool. If you must use Adobe Photoshop, the current version of CodeWeavers' CrossOver Office will run Photoshop in Linux.
These deficiencies might not last long. A CMYK plug-in is in the works, and the Pantone issues are likely to be addressed in the near future as well.
A list of currently supported scanners can be found at http://www.sane-project.org/sane- supported-devices.html. Unfortunately, if your scanner doesn't appear on the list, you should not expect it to work with the SANE software. There is also a list on that same page for drivers not yet included, but you must be able to compile the application from source to use them.NOTE
Although xsane is commonly used as a GIMP plug-in, it can also be used as a standalone program. Another useful program is Joerg Schulenburg's gocr client, used for optical character recognition (OCR). Although not a standalone application, it is included in the Kooka scanning application. This program works best with 300 dots per inch (dpi) scans in several different graphics formats. OCR is a resource-intensive task and can require hundreds of megabytes of disk storage!
Often, a file you want to manipulate in some way is in a format that cannot be used by either your graphics application or the final application. The solution is to convert the image file — sometimes through several formats. The convert utility from ImageMagick is useful, as is the netpbm family of utilities. If it is not already installed, ImageMagick can be installed with the Add Remove Software GUI found in the System Settings menu; the netpbm tools are always installed by default.TIP
Fedora includes dozens of graphics conversion programs that are accessible through the command line, and there are few, if any, graphics file formats that cannot be manipulated when using Linux. These programs can be called in Perl scripts, shell scripts, or command-line pipes to support many types of complex format conversion and image manipulation tasks. See the man pages for the ppm, pbm, pnm, and pgm families of commands. Also see the man page for the convert command, which is part of a suite of extremely capable programs included with the ImageMagick suite.
The netpbm tools are installed by default because they compose the underpinnings of graphics format manipulation. The man page for each image format lists related conversion utilities; the number of those utilities gives you some indication of the way that format is used and shows how one is built on another:Fun with ImageMagick's identify
You can use ImageMagick's identify command to identify details about image files. The welcoming splash image used for the GRUB bootloader is located in /boot/grub and is a gzipped .xpm image. If you run identify on the image, you'll discover that it's a 640×480 xpm image with 16-bit color depth. That's all you need to know to construct a replacement image of your own. Using The GIMP or another graphics tool, crop or resize your chosen image to 640×480 and change the color depth to 16 bits. Save the image as splash.xpm and then gzip the resulting file. Replace the original Fedora file, and you now have a custom boot image. The use of identify helped you duplicate the parameters of the original image to comply with the requirements of GRUB. The identify command is also useful to identify unknown image files and to determine whether they're corrupt.
TIP
An excellent Internet site for CD-related information is http://www.cdmediaworld.com/. The Gracenote CDDB Music Recognition Service licenses a database service to soft ware developers so that they can include additional functionality in their applications by accessing the database and having their applications display information about the music CD, including the artist and song title, the CD's track list, and so on. The data base server at cddb.cddb.org, when contacted by the appropriate software, identifies the appropriate CD and sends the information to be displayed locally. Many CD player applications provide this functionality. The service is interactive: If you have a CD that is not in the CDDB database, the website tells you how you can add the information to the database.
NOTE
You can also use the blank= option with the cdrecord command to erase CD-RW disks. The cdrecord command has fewer options than mkisofs does, but it offers the -multi option, which enables you to make multisession CDs. A multisession CD enables you to write a data track, quit, and then add more data to the CD later. A single-session CD can be written to only once; any leftover CD capacity is wasted. Read about other options in the cdrecord man page.
Current capacity for CD media is 700MB of data or 80 minutes of music. (There are 800MB/90 minute CDs, but they are rare.) Some CDs can be overburned; that is, recorded to a capacity in excess of the standard. The cdrecord command is capable of overburning if your CD-RW drive supports it. You can learn more about overburning CDs athttp://www.cdmediaworld.com/hardware/cdrom/cd_oversize.shtml/.
You need to have the dvd+rw-tools package installed (as well as the cdrtools package). The dvd+rw-tools package contains the growisofs application (that acts as a front end to mkisofs) as well as the DVD formatting utility.TIP
The 4.7GB size of DVD media is measured as 1000 megabytes per gigabyte, instead of the more commonly used 1024 megabytes per gigabyte, so do not be surprised when the actual formatted capacity, about 4.4GB, is less than you anticipated. dvd+rw-tools does not allow you to exceed the capacity of the disk.
CAUTION
Some DVDs come preformatted; formatting them again when you use them for the first time can make the DVD useless. Always be sure to carefully read the packaging your DVD comes in to ensure that you are not about to create another coaster!
TIP
Writing a first session of at least 1GB helps maintain compatibility of your recorded data with other optical drives. DVD players calibrate themselves by attempting to read from specific locations on the disk; you need data there for the drive to read it and calibrate itself.
Also, because of limitations to the ISO9660 file system in Linux, do not start new sessions of a multisession DVD that would create a directory past the 4GB boundary. If you do so, it causes the offsets used to point to the files to "wrap around" and point to the wrong files.
It is possible to pipe data to the growisofs command:TIP
DVD+RW media are capable of only about 1,000 writes, so it is very useful to mount them with the noatime option to eliminate any writing to update their inodes or simply mount them read-only when it's not necessary to write to them.
"The original graphics work for computers was done by Evans & Sutherland on Unix systems. The innovations at MIT's Media Lab were done on Unix workstations. In 1985, we at HP Labs were creating sophisticated multimedia immersive work environments on Unix workstations, so maybe Unix is more multimedia than suggested. Limitations in Linux support doesn't mean Unix had the same limitations. I think it was more a matter of logistics, with hundreds of sound cards and thousands of different possible PC configurations."That last sentence sums it up quite well. Unix had a limited range of hardware to support; Linux has hundreds of sound cards. Sound card device driver support has been long lacking from manufacturers, and there is still no single standard for the sound subsystem in Linux.
Fedora includes software (such as the sox command used to convert between sound formats) so that you can more easily listen to audio files provided in a wide variety of formats, such as AU (from NeXT and Sun), AIFF (from Apple and SGI), IFF (originally from Commodore's Amiga), RA (from Real Audio), and VOC (from Creative Labs).NOTE
Because of patent and licensing issues, Fedora has removed support for the MPEG, MPEG2, and MPEG3 (MP3) file formats in Fedora Linux. Although we cannot offer any legal advice, it appears that individuals using MP3 software are okay; it is just that Fedora cannot distribute the code because it sells its distribution. It seems — at this point — perfectly all right for you to obtain an MP3-capable version of Xmms (for example), which is a Winamp clone that plays MPEG1/2/3 files. You can get Xmms directly from http://www.xmms.org/ because that group has permission to distribute the MP3 code.
You can also enable the MP3 codec within Fedora by using the livna.org yum repository. You do this by installing the gstreamer-plugins-mp3 package, which enables the MP3 codec in all the GNOME applications.
Another alternative is to use the Ogg-Vorbis format; it is completely free of restrictions. A ripper for CD music is available from http://www.thekompany.com/projects/tkcoggripper/ and an MP3-to-Ogg converter is available from http://faceprint.com/ code/. Or, you could download and install the non-crippled versions of multimedia applications from FreshRPMs athttp://www.freshrpms.net/.
Fedora also offers utilities for converting sound files from one format to another. Conversion utilities come in handy when you want to use a sound in a format not accepted by your current application of choice. A repository of conversion utilities resides at http://ibiblio.org/pub/linux/apps/sound/convert/!INDEX.html and includes MP3 and music CD-oriented utilities not found in Fedora. You have to know how to compile and install from source, however. If you see something useful, have a look at http://www.rpmfind.net/ to locate a binary RPM if you don't feel up to the task.TIP
To learn more about the technical details of audio formats, read Chris Bagwell's Audio Format FAQ athttp://www.cnpbagwell.com/audio.html.
The development of support for TV cards in Linux has coalesced under the Video4Linux project. The Video4Linux software provides support for video capture, radio, and teletext devices in Fedora.TIP
Other useful documentation can be found in /usr/src/linux-2.6/Documentation/_video4linux. After you have identified a driver for a device, it does not hurt to look at the source code for it because so little formal documentation exists for many drivers; much of it is in the source code comments.
If you need to convert video from one format to another, you use encoder applications called grabbers. These applications take raw video data from a video device such as a camera or TV card, and convert it to one of the standard MPEG formats or to a still image format, such as JPEG or GIF. Fedora does not supply any encoder applications (other than ppmtompeg, which encodes MPEG-1 video), but you can find them at http://www.freshrpms.net/ or another online source (see the "Reference" section at the end of this chapter).TIP
An RPM that provides a Divx codec for Linux can be found at http://www.freshrpms.net/. Divx is a patented MPEG-4 video codec that is the most widely used codec of its type. It allows for compression of MPEG-2 video by a factor of 8. See http://www.divx. com/ for more information.
The GetCodecs application is a Python script with a GUI interface that downloads, installs, and configures your Fedora system with multimedia codecs not provided by Fedora, such as MP3, Divx, and DVD codecs. The script can be obtained from http://sourceforge.net/projects/getcodecs/.
Another interesting video viewer application is MPlayer (not provided by Fedora), a movie player for Linux. MPlayer can use Win32 codecs and it supports a wider range of video formats than Xine, including Divx and some RealMedia files. MPlayer also uses some special display drivers that support Matrox, 3Dfx, and Radeon cards and can make use of some hardware MPEG decoder boards for better MPEG decoding. Look for Fedora pack ages at http://www.mplayerhq.hu; a Win32 codec package is also available, as well as other codec packages and a GUI interface.Macromedia Flash
The Macromedia Flash plug-in for the Mozilla browser is a commercial multimedia application that isn't provided with Fedora, but many people find it useful. Macromedia Flash enables you to view Flash content at websites that support it. The Mozilla plug-in can be obtained from http://macromedia.mplug.org/. Both .rpm and .tar.gz files are provided.
Having trouble with the Macromedia Flash plug-in for Mozilla? Just manually copy the files flashplayer.xpt and libflashplayer.so to /usr/lib/firefox-2.0.0.x/plugins, where x is the latest point release for Firefox (2.0.0.4 at the time of writing). An .rpm file for Flash that should install without problems is available from http://macromedia.mplug.org/.
Linux, TiVo, and PVRs
Some TiVo users say that using this Linux-based device has changed their lives. Indeed, the convenience of using a personal video recorder (PVR) can make life a lot easier for inveterate channel surfers. Although PVR applications are not included with Fedora, open source developers are working on newer and better versions of easy-to-install and easy-to-use PVR software for Linux. For more information about TiVo, which requires a monthly charge and a phone line (or broadband connection with a newer TiVo2), browse to http://www.tivo.com/. Unrepentant Linux hardware hackers aiming to disembowel or upgrade a TiVo can browse to http://www.9thtee.com/tivoupgrades.htm or read the TiVo Hack FAQ at http://www.tivofaq.com/. A PVR makes viewing television a lot more fun!
A number of Linux sites are devoted to PVR software development. Browse to the DVR project page athttp://www.pierrox.net/dvr/.
ReferenceNOTE
The VideoLAN HOWTO found at http://videolan.org/ discusses the construction of a network for streaming video. Although you might not want to create a network, a great deal of useful information about the software and hardware involved in the enterprise can be generalized for use elsewhere, so it is worth a look. The site also contains a link to a HOWTO about cross-compiling on Linux to produce a Windows binary.
The Internet Printing Protocol
CUPS supports the Internet Printing Protocol, known as IPP, and offers a number of unique features, such as network printer directory (printer browsing) services, support for encryption, and support for PostScript Printer Description (.ppd) files.
According to the Internet Engineering Task Force (IETF), IPP grew out of a 1996 proposal by Novell to create a printing protocol for use over the Internet. Since then, the system has been developed and has matured into a stable print system for use on a variety of Linux and Unix-like operating platforms.
To add a printer to your system, you use the system-config-printer client to create, configure, and save the printer's definition. The client saves the definition as an entry in your system's printer capabilities database, /etc/printcap. Each definition contains a text field with the name of the printer, its host, and name of the print queue. Printed documents are spooled to the /var/spool/cups directory. A sample printcap definition might look like the following:NOTE
Fedora's print system can be used to print to local (attached) or remote (network) printers. If you use a local printer, it is represented by a printer device, such as /dev/ip0 or /dev/usb/ip0 (if you have a USB printer). Local and remote printers use print queues defined in your system's printer capabilities database, /etc/printcap. A document being printed is known as a print job, and you can view and control your list, or queue, of current print jobs in the spool directory, which is /var/spool/cups. Note that you may control only your print jobs; only the root operator can control print jobs of any user on the system.
Because CUPS does not use the traditional Berkeley-style print spooling system, lpd, you can change the name of the printer capabilities database from the default /etc/printcap. Encryption can be used for printing, with secure access behavior determined by settings in /etc/cups/client.conf. Network access settings include port, connection, IP address, domains, and limits to the number and size of client requests.TIP
Do not forget to restart the CUPS server after making any changes to its configuration file. Changes are activated only when the service is restarted (when the daemon rereads its configuration file). See the "GUI-Based Printer Configuration Quick Start" section later in this chapter.
You can configure printing services using either the command line system-config-printer-tui program or the system-config-printer-gui graphical interface. Most of the detailed information in this chapter refers to the use of the GUI. The overview sections that follow, however, give you a solid foundation in both configuration approaches. You learn the details of these processes in later sections of the chapter.CAUTION
Do not manually edit your /etc/printcap. Any changes will be lost when the printing service is restarted or if your system is rebooted. If you need to create customized printer entries, save the entries in /etc/printcap.local and then restart the printing service.
NOTE
The system-config-printer utility is an update to the now-legacy printtool client included with previous Red Hat Linux distributions. Although you might also find related tools (or symbolic links), such as printtool, printconf-tui, and /usr/sbin/printconf-gui installed on your system, you should use the system-config-printer client to manage printers under Fedora.
Name | Description |
---|---|
a2ps | Formats text files for PostScript printing |
accept | Controls CUPS print job destinations |
cancel | Cancels a CUPS print job |
disable | Controls CUPS printers |
dvi[lj, lj4l, lj2p, lj4] | Converts TeX DVI files to specific PCL format |
enable | Controls CUPS printers |
encscript | Converts text files to PostScript |
escputil | Epson Stylus inkjet printer utility |
grolbp | groff driver for Canon LBP-4 and LBP-8 laser printers |
gs | The Ghostscript interpreter |
gsbj [dj500, lp] | Ghostscript BubbleJet printer drivers |
gsdj [dj500, lj, lp] | Ghostscript DeskJet printer drivers |
lpadmin | CUPS command-line-based printer utility |
lp | Starts a CUPS print job |
lpc | A Berkeley-subset CUPS printer control client |
lpf | General printer filter |
lprm | A Berkeley-compatible CUPS job queue utility |
lpstat | Displays CUPS print jobs and printer status |
mpage | PostScript text formatting utility |
pbm[2ppa, page, to10x, toepson, toppa, toptx] | Portable bitmap conversion utilities |
pr | Text formatting command |
psmandup | Duplex printing utility for nonduplex printers |
reject | Controls CUPS print job destinations |
setup | Launches printer configuration tool |
smbclient | SMB print spooler |
smbprint | SMB print shell script |
smbspool | SMB printer spooler |
thinkjettopbm | Portable bitmap to ThinkJet printer conversion utility |
The gs command outputs many lines of help text on command-line usage and then lists built-in printer and graphics devices. Another way to get this information is to start gs and then use the devicenames == command like this:NOTE
Fedora includes graphical clients you can use to view many different types of documents. For example, to display PostScript documents (including compressed PostScript documents) or PostScript images, use the gv client. To display Portable Document Format (PDF) documents, you can use gv or the xpdf client.
Aladdin or GNU?
At least two versions of Ghostscript are available for Linux. One version is named AFPL Ghostscript, which formerly went by the name Aladdin Ghostscript. This version is licensed under the Aladdin Free Public License, which disallows commercial distribution. The other version is called GNU Ghostscript, which is distributed under the GNU General Public License. For details about the different versions or for answers to questions regarding licensing, see the Ghostscript home page at http://www.cs.wisc.edu/~ghost/.
You can experiment to see which printer selection works best for your printer if its model is not listed. You might not be able to use all the features of your printer, but you will be able to set up printing service. Click Forward when you have made your choice.NOTE
You can also browse to http://www.linuxprinting.org/ to find out what drivers to use with your printer or to see a cross-referenced listing of printers supported by each driver. You might also find new and improved drivers for the latest printers on the market.
TIP
You can also configure multiple print queues for the same printer. Use this technique to test printing using different print drivers with the same printer. Create a new queue, give it a specific name (such as testpcl3), and select a different printer. Finish the configuration and print a test page to compare the results against other entries to find the best output. You can also use this technique to define a monochrome or color printer entry for the same printer or to use different drivers for different types of media (such as regular or photo paper).
Related Fedora and Linux Commands
The following commands help you manage printing services:
► accept — Controls print job access to the CUPS server via the command line
► cancel — Cancels a print job from the command line
► cancel — Command-line control of print queues
► disable — Controls printing from the command line
► enable — Command-line control CUPS printers
► lp — Command-line control of printers and print service
► lpc — Displays status of printers and print service at the console
► lpq — Views print queues (pending print jobs) at the console
► lprm — Removes print jobs from the print queue via the command line
► lpstat — Displays printer and server status
► system-config-printer — Fedora's graphical printer configuration tool
To get the NVIDIA driver using yum, you need to have enabled the Livna repository (see Chapter 34, "Advanced Software Management," for more information on setting up repositories). At the command line, typeCAUTION
The Livna repository is home to not only a wide range of kernel modules and drivers for many popular items of hardware, but also contains a number of legally question able packages that are not enabled in Fedora by default, including native MP3 support. If you are using Fedora for personal use, you should not have any real problems, but make sure to check before you start installing packages from Livna onto a corporate workstation or server!
CAUTION
Both sets of graphics card drivers are very dependent on the kernel version you are running. Every time you update your kernel, you also have to update your driver. If you have used the kmod-* package from Livna, it should automatically update when you run yum upgrade.
Among the games are hangman (see Figure 9.7), an anagram game, a tool to learn about the periodic table of elements, and a great stargazing tool called Kstars. There are others for you to explore and that can provide hours of learning and fun for your children.NOTE
You can probably tell by the name that KDEedu is a KDE-based package. As a result, when you install KDEedu, you also need to install several KDE components, enough in fact to allow you to run KDE. See Chapter 3, "Working with GNOME," for more information about KDE and how to access it.
TIP
The keys to successful gaming in Linux are to always read the documentation thoroughly, always investigate the Internet resources thoroughly, and always understand your system. Installing games is a great way to learn about your system because the reward of success is so much fun.
A regular user is someone who logs on to the system to make use of it for nonadministrative tasks such as word processing or email. These users do not need to make systemwide changes, nor do they have to manage any other users. However, they might want to be able to change settings that are specific to them (for instance, a desktop background). Of course, depending on how draconian the root user is, regular users might not even be able to do that!NOTE
On your Fedora system, when you log in as root, you are root or the super user. In this chapter, the terms root, super user, system administrator, and sysadmin are used interchangeably, although they need not all refer to a single person.
The third type of user is the system user. The system user is not a person, but rather an administrative account that the system uses during day-to-day running of various services. For example, the system user named apache owns the Apache Web Server and all the associated files. Only it and root can have access to these files — no one else can access or make changes to these files. System users do not have a home directory or password, nor do they permit access to the system through a login prompt.CAUTION
Because of the potential for making a catastrophic error as the super user (using the command rm -rf /* is the classic example, but do not ever try it!), always use your system as a regular user and become root only temporarily to do sysadmin duties. While you are on a multiuser system, consider this advice an absolute rule; if root were to delete the wrong file or kill the wrong process, the results could be disastrous for the business. On your home system, you can do as you please and running as root makes many things easier, but less safe. In any setting, however, the risks of running as root full time are significant. (In case you're wondering, the above command would completely wipe your entire file system, leaving you with nothing but a red face!)
NOTE
A Linux username can be any alphanumeric combination that does not begin with a special character reserved for shell script use (see Chapter 11, "Automating Tasks," for disallowed characters, mostly punctuation characters). Usernames are typically the user's first name plus the first initial of her last name, something that is a common practice on larger systems with many users because it makes life simpler for the sysadmin, but is neither a rule nor a requirement.
CAUTION
If you intend to make use of NFS, it is extremely important that you use the same UID for the user on the host and guest machines; otherwise, you will not be able to connect!
User Stereotypes
As is the case in many professions, exaggerated characterizations (stereotypes or caricatures) have emerged for users and system administrators. Many stereotypes contain elements of truth mixed with generous amounts of hyperbole and humor and serve to assist us in understanding the characteristics of and differences in the stereotyped subjects. The stereotypes of the "luser" and the "BOFH" (users and administrators, respectively) also serve as cautionary tales describing what behavior is acceptable and unacceptable in the computing community.
Understanding these stereotypes allows you to better define the appropriate and inappropriate roles of system administrators, users, and others. The canonical reference to these terms is found in the alt.sysadmin.recovery FAQ found at http://www.ctrl-c.liu.se/~ingvar/asr/.
► userdel — This command completely removes a user's account (thereby eliminating that user's home directory and all files it contains).NOTE
The set of files initially used to populate a new user's home directory are kept in /etc/skel. This is convenient for the system administrator because any special files, links, or directories that need to be universally applied can be placed in /etc/skel and will be duplicated automatically with appropriate permissions for each new user.
# ls -al /etc/skel
total 60
drwxr-xr-x 4 root root 4096 2007-10-21 19:58 .
drwxr-xr-x 112 root root 12288 2007-10-22 20:40 ..
-rw-r--r-- 1 root root 33 2007-08-31 15:20 .bash_logout
-rw-r--r-- 1 root root 176 2007-08-31 15:20 .bash_profile
-rw-r--r-- 1 root root 124 2007-08-31 15:20 .bashrc
drwxr-xr-x 2 root root 4096 2007-10-17 17:52 .gnome2
Each line provides the file permissions, the number of files housed under that file or directory name, the file owner, the file group, the file size, the creation date, and the filename.
As you can see, root owns every file here, but the adduser command (a symbolic link to the actual command named useradd) copies everything in /etc/skel to the new home directory and resets file ownership and permissions to the new user. Certain user files might exist that the system administrator does not want the user to change; the permissions for those files in /home/username can be reset so that the user can read them but can't write to them.
► usermod — This command changes several user attributes. The most commonly used arguments are -s to change the shell and -u to change the UID. No changes can be made while the user is logged in or running a process.TIP
To lock a user out of his account, use the following command:
# passwd -l username
This prepends a double ! (exclamation point, also called a bang) to the user's encrypted password; the command to reverse the process uses the -u option. This is a more elegant and preferred solution to the problem than the traditional UNIX way of manually editing the file.
The last command searches through the /var/log/wtmp file and lists all the users logged in and out since that file was first created. The user reboot exists so that you might know who has logged in since the last reboot. A companion to last is the command lastb, which shows all failed, or bad, logins. It is useful for determining whether a legitimate user is having trouble or a hacker is attempting access.TIP
Interestingly, a phenomenon known as timewarp can occur in which an entry in the wtmp files jumps back into the past and ac shows unusual amounts of connected time for users. Although this can be attributed to some innocuous factors having to do with the system clock, it is worthy of investigation by the sysadmin because it can also be the result of a security breach.
NOTE
The accounting system on your computer keeps track of user usage statistics and is kept in the current /var/log/wtmp file. That file is managed by the init and login processes. If you want to explore the depths of the accounting system, use the GNU info system: info accounting.
NOTE
In Linux, you can create groups to assign a number of users access to common directories and files based on permissions. You might assign everyone in accounting to a group named accounting, for example, 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 also allow or deny access to your files by other groups by modifying the group permissions of your files.
Files or programs that have suid or guid permissions can sometimes present security holes because they bypass normal permissions. This problem is especially compounded if the permission extends to an executable binary (a command) with an inherent security flaw because it could lead to any system user or intruder gaining root access. In past exploits, this typically happened when a user fed a vulnerable command with unexpected input (such as a long pathname or option); the command would bomb out, and the user would be presented a root prompt. Although Linux developers are constantly on the lookout for poor programming practices, new exploits are found all the time, and can crop up unexpectedly, especially in newer software packages that haven't had the benefit of peer developer review.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 permission to access a sound device.
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 execute permission of the program for anyone. You have to decide, as the root operator, whether your users are allowed to, for example, 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, and chage commands.NOTE
The find command is quite helpful and can be used for many purposes, such as before or during backup operations. See the section "Using Backup Software" in Chapter 13, "Backing Up."
PAM Explained
Pluggable Authentication Modules (PAM) is a system of libraries that handle the tasks of authentication on your computer. It uses four management groups: account management, authentication management, password management, and session management. This allows the system administrator to choose how individual applications will authenticate users. Fedora has preinstalled and preconfigured all the necessary PAM files for you.
The configuration files in Fedora are found in /etc/pam.d. These files are named for the service they control, and the format is as follows:
type control module-path module-arguments
The type field is the management group to which the rule corresponds. The control field tells PAM what to do if authentication fails. The final two items deal with the PAM module used and any arguments it needs. Programs that use PAM typically come pack aged with appropriate entries for the /etc/pam.d directory. To achieve greater security, the system administrator can modify the default entries. Misconfiguration can have unpredictable results, so back up the configuration files before you modify them. The defaults provided by Fedora are adequate for home and small office users.
An example of a PAM configuration file with the formatted entries as described previously is shown next. Here are the contents of /etc/pam.d/system-config-users:
#%PAM-1.0
auth include config-util
account include config-util
session include config-util
Amusingly, even the PAM documents state that you do not really need (or want) to know a lot about PAM to use it effectively.
You will likely need only the PAM system administrator's guide. Look under the /usr/share/doc/pam* directory for additional documents in PostScript, text, and HTML formats.
Because almost all Linux file system security revolves around file permissions, it can be useful to occasionally become a different user with permission to access files belonging to other users or groups or to access special files (such as the communications port /dev/ttyS0 when using a modem, or the sound device /dev/audio when playing a game). You can use the su command to temporarily switch to another user identity, and then switch back.NOTE
A popular misconception is that the su command is short for super user; it just means substitute user. An important but often overlooked distinction is that between su and su -. In the former instance, you become that user but keep your own environmental variables (such as paths). In the latter, you inherit the environment of that user. This is most noticeable when you use su to become the super user, root. Without appending the -, you do not inherit the path variable that includes /bin or /sbin, so you must always enter the full path to those commands when you just su to root.
The su command spawns a new shell, changing both the UID and GID of the existing user and automatically changes the environmental variables associated with that user. This behavior is known as inheriting the environment. See Chapter 4, "Command-Line Quick Start," for more information on environmental variables.TIP
It is never a good idea to use an Internet Relay Chat (IRC) client as the root user, and you might not want to run it using your regular user account. Just create a special new user just for IRC and su to that user in a terminal widow to launch your IRC client.
NOTE
No graphical tools supported by Fedora can be used to configure disk quotas. A Quota mini-HOWTO is maintained at http://www.tldp.org/HOWTO/Quota.html.Related Fedora Commands
You will use these commands to manage user accounts in Fedora:
► ac — A user account-statistics command
► change — Sets or modifies user password expiration policies
► chfn — Creates or modifies user finger information in /etc/passwd
► chgrp — Modifies group memberships
► chmod — Changes file permissions
► chown — Changes file ownerships
► chpasswd — Batch command to modify user passwords
► chsh — Modifies a user's shell
► groups — Displays existing group memberships
► logname — Displays a user's login name
► newusers — Batches user management command
► passwd — Creates or modifies user passwords
► su — Executes shell or command as another user
► sudo — Manages selected user execution permissions
► system-config-users — Fedora's graphical user management tool
► useradd — Creates, modifies, or manages users
► userinfo — Fedora's graphical chfn command
► usermod — Edits a user's login profile
► userpasswd — Fedora's graphical user password command
Next, the BIOS looks on the bootable volume for boot code in the partition boot sector also known as the Master Boot Record (MBR) of the first hard disk. The MBR contains the boot loader code and the partition table — think of it as an index for a book, plus a few comments on how to start reading the book. (We cover the MBR in more detail in Chapter 35, "Managing the File System.") If the BIOS finds a boot loader, it loads the boot loader code into memory. At that point, the BIOS's job is completed, and it passes control of the system to the boot loader.NOTE
If the BIOS detects a hardware problem, the boot process fails and the BIOS generates a few beeps from the system speaker. These "beep codes" indicate the nature of the problem the BIOS has encountered. The codes vary among manufacturers, and the diagnosis of problems occurring during this phase of the boot process is beyond the scope of this book and does not involve Linux. If you encounter a problem, you should consult the motherboard manual or contact the motherboard's manufacturer.
NOTE
Linux is very flexible and can be booted from multiple images on a CD-ROM, over a network using PXE (pronounced "pixie") or NetBoot, or on a headless server with the console display sent over a serial or network connection. Work is even underway to create a special Linux BIOS at http://www.linuxbios.org/ that expedites the boot process because Linux does not need many of the services offered by the typical BIOS.
This kind of flexibility enables Linux to be used in a variety of ways, such as remote servers or diskless workstations, which are not generally seen in personal home use.
This next step of the boot process begins with a message that the Linux kernel is loading, and a series of messages is printed to the screen, giving you the status of each command in rc.sysinit script language. A failure should display an error message. The -quiet option may be passed to the kernel at boot time to suppress many of these messages.NOTE
Details about the sequence of events that occur when the Linux kernel is loaded can be found in the file /usr/src/iinux-2.6/init/main.c if you installed the Linux kernel documentation.
You use runlevels to manage the system services running on your computer. All these special files and scripts are set up during your installation of Fedora Linux, and they receive their initial values based on your choices during the installation — as described in Chapter 1, "Installing Fedora," You can change and control them manually, as you learn later in this chapter, using tools of varying sophistication.NOTE
The System V method makes extensive use of symbolic links, which are ways to reference a file in another location and make it appear as if it were in two or more places at once. The benefit is that you need to edit only one file to change them all. In addition, any reorganization to be done means that only links need to be changed, not the files themselves.
Each runlevel tells the init command what services to start or stop. Although runlevels might all have custom definitions, Fedora has adopted some standards for runlevels:NOTE
Not all Linux distributions use the same runlevel configurations or runlevel definitions! For example, although Fedora uses runlevel 3 for a full, console-based multiuser mode, pre-7.1 versions of SUSE Linux defined this system state as runlevel 2. Red Hat, Fedora, and SUSE now use the same runlevels to conform to the Linux Standards Base, or LSB. As a system administrator, you should be aware of this issue, especially if you have devised any administrative scripts or tools that deal with system states.
CAUTION
Never forget that uncontrolled physical access is virtually a guarantee of access to your data by an intruder.
The GRUB boot loader passes arguments, or commands, to the kernel at boot time. These arguments are used, among other things, to tell GRUB where the kernel is located and also to pass specific parameters to the kernel, such as how much memory is available or how special hardware should be configured.NOTE
If you have enabled a GRUB password, you must first press p, type your password, and then press Enter before using this boot method.
After all the system scripts have been run, your system is configured and all the necessary system services have been started. If you are using a runlevel other than 5, the final act of the init process is to launch the user shell, which on Linux is nearly always bash. The shell launches and you see a login prompt on the screen.TIP
You can write your own init scripts, using the existing scripts as examples. Sample scripts can also be found in /usr/share/doc/initscripts/sysvinitfiles, along with a brief tutorial written by Red Hat and a brief explanation of all the options available to use in init scripts.
The Fedora tool setup is an ncurses-based menu for all the available ncurses-based command-line configuration tools (see Figure 11.2). It can be used to access ntsysv and all the other command-line configuration tools.NOTE
ntsysv is simple to use and it's an excellent tool for a system without X, but it works for only the runlevel in which you are currently. Use the --level option to modify other runlevels.
TIP
Linux is full of shortcuts: If you exit the single-user shell by typing exit at the prompt, you go back to the default runlevel without worrying about using telinit.
Change to runlevel 3 by switching to another virtual console with Ctrl+Alt+F2, logging in as root, and running the command telinit 3. This switch to runlevel 3 stops the X server from attempting to restart. Now you can easily examine the error and attempt to fix it.TIP
If you are working on a multiuser system and might inadvertently interrupt the work of other users, ask them to save their current work; then change to a safer runlevel, such as single-user mode.
CAUTION
Before making any changes to any configuration file, always make a backup copy of the original, unmodified file. Our practice is to append the extension .original to the copy because that is a unique and unambiguous identifier.
If you need to restore the original configuration file, do not rename it, but copy it back to its original name.
Relevant Fedora Commands
Here are some of the commands you learned so far:
► chkconfig — Fedora's text-only command-line runlevel configuration utility
► ntsysv — Fedora's text-based system services configuration tool for the command line
► setup — Actually a bash script, it is a menu to all the individual ncurses-based configuration tools, including ntsysv
► system-config-services — Fedora's GUI runlevel configuration tool, named Configure Services
► telinit — Changes the current runlevel
There are alternative ways of specifying dates. For example, you can use sets of dates and times by using hyphens or commas, such as hours 9-15 would execute at 9, 10, 11, 12, 13, 14, and 15 (from 9 a.m. to 3 p.m.), whereas 9, 11, 13, 15 would miss out at the even hours. Note that it is important that you do not put spaces into these sets because the cron daemon would interpret them as the next field. You can define a step value with a slash (/) to show time division: */4 for hours means "every four hours all day," and 0 12/3 means "every three hours from midnight to noon." You can also specify day and month names rather than numbers, using three-character abbreviations: Sun, Mon, Tue, Fri, Sat for days, or Jan, Feb, Mar, Oct, Nov, Dec for months.CAUTION
The cron daemon reads all the system crontab files and all user crontab files once a minute (on the minute; that is, at 6:00:00, 6:01:00, and so on) to check for changes. However, any new jobs it finds are not executed until at least one minute has passed.
For example, if it is 6:01:49 (that is, 49 seconds past one minute past 6 a.m.) and you set a cron job to run at 6:02, it does not execute. At 6:02, the cron daemon rereads its configuration files and sees the new job, but is not able to execute it. If you set the job to run at 6:02 a.m. every day, it is executed the following morning and every subsequent morning.
This same situation exists when deleting jobs. If it is 6:01:49 and you have a job scheduled to run at 6:02, deleting the job makes no difference: cron runs it before it rereads the crontab files for changes. However, after it has reread the crontab file and noticed the job is no longer there, it is not executed on subsequent days.
Name | Description | Location |
---|---|---|
ash | A small shell (sh-like) | /bin/ash |
ash.static | A version of ash not dependent on software libraries | /bin/ash.static |
bash | The Bourne Again SHell | /bin/bash |
bsh | A symbolic link to ash | /bin/bsh |
csh | The C shell, a symbolic link to tcsh | /bin/csh |
ksh | The Korn shell | /bin/ksh, /usr/bin/ksh |
pdksh | A symbolic link to ksh | /usr/bin/pdksh |
rsh | The restricted shell (for network operation) | /usr/bin/rsh |
sash | A standalone shell | /sbin/sash |
sh | A symbolic link to bash | /bin/sh |
tcsh | A csh-compatible shell | /bin/tcsh |
zsh | A compatible csh, ksh, and sh shell | /bin/zsh |
Learning More About Your Shell
All the shells listed in Table 11.1 have accompanying man pages, along with other documentation under the /usr/share/doc directory. Some of the documentation can be quite lengthy, but it is generally much better to have too much documentation than too little! The bash shell includes more than 100 pages in its manual, and the zsh shell documentation is so extensive that it includes the zshall meta man page (use man zshall to read this overview)!
Grokking grep
If you plan to develop shell scripts to expand the capabilities of pattern-matching commands such as grep, you will benefit from learning more about using expressions. One of the definitive guides to using the pattern-matching capabilities of Unix and Linux commands is Mastering Regular Expressions by Jeffrey E. F. Freidl (O'Reilly), ISBN: 0-596-00289-0.
CAUTION
Make sure that you read your command carefully when using wildcards; an all-too-common error is to type something like rm -rf * .txt with a space between the * and the .txt. By the time you wonder why the command is taking so long, bash will already have deleted most of your files. The problem is that it treats the * and the .txt separately. * matches everything, so bash deletes all your files.
Related Fedora and Linux Commands
You can use these commands and tools when using the shell or writing shell scripts:
► chsh — Command used to change one's login shell
► kibitz — Allows two-person interaction with a single shell
► mc — A visual shell named the GNU Midnight Commander
► nano — An easy-to-use text editor for the console
► system-config-users — A graphical user-management utility that can be used to change one or more user login shells
► shar — Command used to create shell archives
► vi — The vi (actually vim) text editor
Another useful system-monitoring tool is vmstat (virtual memory statistics). This command reports on processes, memory, I/O, and CPU, typically providing an average since the last reboot; or you can make it report use for a current period by telling it the time interval in seconds and the number of iterations you desire, as follows:TIP
A useful trick is to employ the watch command; it repeatedly reruns a command every 2 seconds by default. If you use
# watch free
you can see the output of the free command updated every 2 seconds.
Data can also be lost because of malfunctions that corrupt the data as it attempts to write to the disk. Other applications, utilities, and drivers might be poorly written, buggy (the phrase most often heard is "still beta quality"), or might suffer some corruption and fail to correctly write that all-important data you just created. If that happens, the contents of your data file would be indecipherable garbage, of no use to anyone.A Case in Point
A recent Harris poll of Fortune 500 executives found that roughly two-thirds of them had problems with their backups and disaster-recovery plans. How about you?
Proper backups can help you recover from these problems with a minimum of hassle, but you have to put in the effort to keep backups current, verify their intactness, and practice restoring the data in different disaster scenarios.TIP
To make a backup of a configuration file you are about to edit, use the cp command:
$ cp filename filename.original
And to restore it:
$ cp filename.original filename
Never edit or move the *.original file, or the original copy will be lost.
Many people also fail to consider the element of time when formulating their plan. Some backup devices are faster than others, and some recovery methods are faster than others. You need to consider that when making choices.TIP
If you are not willing or capable of assessing your backup needs and choosing a backup solution, a legion of consultants, hardware vendors, and software vendors would love to assist you. The best way to choose one in your area is to query other Unix and Linux system administrators (located through user groups, discussion groups, or mail lists) that are willing to share their experiences and make recommendations. If you cannot get a referral, ask the consultant for references and check them out.
Sound Practices
You have to create your own best-backup plan, but here are some building blocks that should be incorporated into the foundation of any sound backup program:
► Maintain more than one copy of critical data.
► Label the backups.
► Store the backups in a climate-controlled and secure area.
► Use secure, offsite storage of critical data. Many companies choose bank vaults for their offsite storage, and this is highly recommended.
► Establish a backup policy that makes sense and can be followed religiously. Try to back up your data when the system is consistent (that is, no data is being written), which is usually overnight.
► Keep track of who has access to your backup media, and keep the total number of people as low as possible. If you can, allow only trusted personnel near your backups.
► Routinely verify backups and practice restoring data from them.
► Routinely inspect backup media for defects and regularly replace them (after destroying the data on them, if it is sensitive).
NOTE
If you are a new sysadmin, you might be inheriting an existing backup strategy. Take some time to examine it and see whether it meets the current needs of the organization. Think about what backup protection your organization really needs, and determine whether the current strategy meets that need. If it does not, change the strategy. Consider whether users practice the current policy, and, if not, why it is not.
The following sections examine a few of the many strategies in use today. Many strategies are based on these sample schemes; one of them can serve as a foundation for the strategy you construct for your own system.Backup Levels
Unix uses the concept of backup levels as a shorthand way of referring to how much data is backed up in relation to a previous backup. It works this way:
A level 0 backup is a full backup. The next backup level would be 1. Backups at the other numbered levels back up everything that has changed since the last backup at that level or a numerically higher level (the dump command, for example, offers 10 different backup levels). For example, a level 3 backup followed by a level 4 generates an incremental backup from the full backup, whereas a level 4 followed by a level 3 generates a differential backup between the two.
Tape equipment is well supported in Linux and, when properly maintained, is extremely reliable. The tapes themselves are inexpensive, given their storage capacity and their opportunity for reuse. Be aware, however, that tapes do deteriorate over time and, being mechanical, tape drives can and will fail.TIP
Older tape equipment is often available in the used equipment market and might be useful for smaller operations that have outgrown more limited backup device options.
CAUTION
Neglecting to clean, align, and maintain tape drives puts your data at risk. The tapes themselves are also susceptible to mechanical wear and degradation. Hardware maintenance is part of a good backup policy. Do not ever forget that it is a question of when — not if — hardware will fail.
NOTE
The software in a backup system must support the hardware, and this relationship can determine which hardware or software choices you make. Many sysadmins choose a particular backup software not because they prefer it to other options, but because it supports the hardware they own.
The price seems right for free backup tools, but consider the software's ease of use and automation when assessing costs. If you must spend several hours implementing, debugging, documenting, and otherwise dealing with overly elaborate automation scripts, the real costs go up.
NOTE
The tar command can back up to a raw device (one with no file system) as well as a formatted partition. For example,
# tar cvzf /dev/hdd /boot /etc /home
backs up those directories to device /dev/hdd (not /dev/hda1, but to the unformatted device itself).
The tar command can also back up over multiple floppy disks:
# tar czvMf /dev/fd0 /home
backs up the contents of /home and spreads the file out over multiple floppies, prompting you with this message:
Prepare volume #2 for '/dev/fd0' and hit return:
File Roller is well integrated with the GNOME desktop environment to provide convenient drag-and-drop functionality with the Nautilus file manager. To create a new archive, select Archive, New to open the New Archive dialog box and navigate to the directory where you want the archive to be kept. Type your archive's name in the Selection: /root text box at the bottom of the New Archive dialog box. Use the Archive type drop-down menu to select a compression method. Now, drag the files that you want to be included from Nautilus into the empty space of the File Roller window, and the animated icons will show that files are being included in the new archive. When you are finished, a list of files will be shown in the previously blank File Roller window (see Figure 13.1). To save the archive, simply select Archive, Close. Opening an archive is as easy as using the Archive, Open dialog to select the appropriate archive file.CAUTION
File Roller does not complain if you select a compression format that is not supported by installed software until after you attempt to create the archive. Install any needed compression utilities first.
There is no GUI interface for Amanda. Configuration is done in the time-honored Unix tradition of editing text configuration files located in /etc/amanda. The default installation in Fedora includes a sample cron file because it is expected that you will be using cron to run Amanda regularly. The client utilities are installed with the package am-utils; the Amanda server must be obtained from the Amanda website. As far as backup schemes are concerned, Amanda calculates an optimal scheme on the fly and schedules it accordingly. It can be forced to adhere to a traditional scheme, but other tools are possibly better suited for that job.CAUTION
Amanda does not support dump images larger than a single tape and requires a new tape for each run. If you forget to change a tape, Amanda continues to attempt backups until you insert a new tape, but those backups will not capture the data as you intended them to. Do not use too small a tape or forget to change a tape, or you will not be happy with the results.
Alternatives to the Fedora Rescue Disc
The Fedora rescue disc might be inadequate for your system restoration needs; it might lack specific ethernet device support, file system support, or the kind of full utility functionality that you require for a successful recovery operation. An alternative exists in the SuperRescue CD created by H. Peter Anvin.
Essentially, the SuperRescue CD is a reasonably full and robust Red Hat distribution (based on Red Hat 7.2 and the 2.4.20-rc1 kernel) that runs completely from a bootable CD. The best thing about the SuperRescue CD is that it comes with build scripts, so it is incredibly easy to add new software (that special driver or application) and create a new CD. The home page is at http://freshmeat.net/projects/superrescue/, but you can grab a copy directly at http://www.kernel.org/pub/dist/superrescue/v2/.
Relevant Fedora Commands
The following commands are useful in performing backup, recovery, and restore operations in Fedora:
► amdump — Amanda is a network-based backup system, consisting of 18 separate commands, for use with Linux.
► ark — A KDE desktop GUI archiving utility.
► cp — The copy command.
► scp — The secure shell copy command.
► cpio — A data archive utility.
► dd — A data copy and conversion utility.
► gzip — The GNU compression utility.
► tar — The GNU tape archive utility.
NOTE
The network configuration process described in this section is for client hosts. You cannot perform server network configuration, such as Domain Name System (DNS) and DHCP during installation. (See Chapter 23, "Managing DNS," for more information on configuring DNS; see the "DHCP" section later in this chapter for more information on that item.)
When you finish configuring your NIC or editing an IP address or assignment scheme for a NIC, save your changes, using the File menu's Save menu item. Note that you can also use the Profile menu (as shown previously in Figure 14.1) to create different network configurations and IP address assignments for your installed NICs. This is handy if you want to create, for example, a different network setup for home or work on a laptop running Fedora.NOTE
Bootp is the initial protocol on which DHCP was built, and it has mostly been replaced by DHCP.
Use | Option | Example |
---|---|---|
Create alias | [network device] | ifconfig eth0:0_:[number] |
Change IP address | 10.10.10.10 | ifconfig eth0 10.10.10.12 |
Change the netmask | netmask [netmask] | ifconfig eth0 netmask 255.255.255.0 |
Change the broadcast | broadcast [address] | ifconfig eth0 broadcast 10.10.10.255 |
Take interface down | down | ifconfig eth0 down |
Bring interface up | up (add IP address) | ifconfig eth0 up (ifconfig eth0 10.10.10.10) |
Set NIC promiscuous | [-]promisc [ifconfig eth0 -promisc] | ifconfig eth0 promisc mode on [off] |
Set multicasting mode | [-]allmulti | ifconfig eth0_on [off] allmulti [ifconfig eth0 - allmulti] |
Enable [disable] [address] | [-]pointopoint eth0_pointopoint | ifconfig_point-to-point address 10.10.10.20 [ifconfig eth0 pointopoint_10.10.10.20] |
If no argument is given, ifconfig displays the status of active interfaces. For example, the output of ifconfig, without arguments and one active and configured NIC, looks similar to this:NOTE
Promiscuous mode causes the NIC to receive all packets on the network. It is often used to sniff a network. Multicasting mode enables the NIC to receive all multicast traffic on the network.
Option | Output |
---|---|
-g | Displays the multicast groups configured |
-i | Displays the interfaces configured by ifconfig |
-s | Lists a summary of activity for each protocol |
-v | Gives verbose output, listing both active and inactive sockets |
-c | Updates output every second (good for testing and troubleshooting) |
-e | Gives verbose output for active connections only |
-C | Displays information from the route cache and is good for looking at past connections |
CAUTION
If you make use of NetworkManager to handle your network connections, don't make any changes to /etc/resolv.conf, because it will cause havoc for NetworkManager. Instead, let NetworkManager dynamically work with this file of its own accord.
Fedora and Networking
Chances are that your network card was configured during the installation of Fedora. You can, however, use the ifconfig command at the shell prompt or Fedora's graphical network configuration tools, such as system-config-network, to edit your system's network device information or to add or remove network devices on your system. Hundreds of networking commands and utilities are included with Fedora — far too many to cover in this chapter and more than enough for coverage in two or three volumes.
Nearly all ethernet cards can be used with Linux, along with many PCMCIA wired and wireless network cards. The great news is that many USB wireless network devices also work just fine with Linux, and more will be supported with upcoming versions of the Linux kernel. Check the Linux USB Project at http://www.linux-usb.org/ for the latest developments or to verify support for your device.
After reading this chapter, you might want to learn more about other graphical network clients for use with Linux. The GNOME ethereal client, for example, can be used to monitor all traffic on your LAN or specific types of traffic. Another client, NmapFE, can be used to scan a specific host for open ports and other running services.
► Class B — Consists of networks defined by the first two octets, with the first ranging from 128 to 191. The "128." network is also reserved for local network use. There are 16,382 Class B networks — each with 65,534 possible hosts.NOTE
Notice that zero is not included in Class A. The zero address is used for network-to-network broadcasts. Also, note that there are two other classes of networks, Classes D and E. Class D networks are reserved for multicast addresses and are not for use by network hosts. Class E addresses are deemed experimental, and thus are not open for public addressing.
Limits of Current IP Addressing
The current IPv4 address scheme is based on 32-bit numbering and limits the number of available IP addresses to about 4.1 billion. Many companies and organizations (particularly in the United States) were assigned very large blocks of IP addresses in the early stages of the growth of the Internet, which has left a shortage of "open" addresses. Even with careful allocation of Internet-connected host IP addresses and the use of network address translation (NAT) to provide communication to and from machines behind an Internet-connected computer, the Internet might run out of available addresses.
To solve this problem, a newer scheme named IPv6 (IP version 6) is being implemented. It uses a much larger addressing solution based on 128-bit addresses, with enough room to include much more information about a specific host or device, such as global positioning server (GPS) or serial numbering. Although the specific details about the entire contents of the an IPv6 address have yet to be finalized, all Internet- related organizations appear to agree that something must be done to provide more addresses. It's difficult to gauge just how big the Internet actually is, but according to Internet World Stats, some 1.224 billion people use the Internet as of September 2007. Multiply that by the number of mail servers, newsgroup servers and other web servers that are attached to the web and you will quickly find that the range of addresses supplied by IPv4 is quickly running out.
You can get a good overview of the differences between IPv4 and IPv6 policies regarding IP address assignments, and the registration process of obtaining IP addresses, by browsing to http://www.arin.net/library/index.html. Read the Linux IPv6 HOWTO by browsing tohttp://tldp.org/HOWTO/Linux+IPv6-HOWTO/.
Fedora supports the use of IPv6 and includes a number of networking tools conforming to IPv6 addressing. You can configure support for IPv6 by using settings and options in the file named network under the /etc/sysconfig directory, along with making changes to related network configuration files, such as /etc/hosts. Many IPv6-based tools, such as ipcalc6, ping6, and traceroute6, are available for Fedora. See various files under the /usr/share/doc/initscripts directory for more information specific to setting up IPv6 addressing with Linux and Fedora. Migration to IPv6 is slow in coming, however, because the majority of computer operating systems, software, hardware, firmware, and users are still in the IPv4 mindset. Supporting IPv6 will require rewrites to many networking utilities, portions of operating systems currently in use, and firmware in routing and firewall hardware.
NOTE
You can learn more about DHCP by reading RFC 2131, "Dynamic Host Configuration Protocol." Browse tohttp://www.ietf.org/rfc/rfc2131.txt.
NOTE
The problem of using DHCP to configure servers that make use of registered host- names is being addressed by Dynamic DNS which, when fully developed, will enable DHCP to register IP addresses with DNS. This will allow you, for example, to register a domain name (such as imalinuxuser.com) and be able to easily access that domain's web server without needing to use static IP addressing of a specific host. The largest hurdle to overcome is the security implication of enabling each host connecting to the system to update DNS. A few companies, such as DynDNS (http://www.dyndns.com/), are already offering Dynamic DNS services and have clients for Linux.
NOTE
For whichever installation method you choose, be sure that a file called /etc/dhcpd.leases is created. The file can be empty, but it does need to exist for dhcpd to start properly.
The next part of the dhcpd.conf deals with the different subnets that your DHCP server serves; this section is quite straightforward. Each subnet is defined separately and can look like this:NOTE
The dhcpd.conf file requires semicolons (;) after each command statement. If your configuration file has errors or runs improperly, check for this.
CAUTION
Remember, only one DHCP server should exist on a local network to avoid problems. Your DHCP might not work correctly on a LAN with hosts running outdated legacy operating systems. Often Windows NT servers have the Windows DHCP server installed by default. Because there is no configuration file for NT to sort through, that DHCP server configures your host before the Linux server if both machines are on the same LAN. Check your Windows NT servers for this situation and disable DHCP on the Windows NT server; afterward, your other DHCP-enabled hosts should configure correctly. Also, check to make sure that there are no conflicts if you use a cable or DSL modem, wire less access point (WAP), or other intelligent router on your LAN that can provide DHCP
NOTE
Do not rely on a single point of protection for your LAN, especially if you use wireless networking, provide dial-in services, or allow mobile (laptop or PDA) users internal or external access to your network. Companies, institutions, and individuals relying on a "moat mentality" have often discovered to their dismay that such an approach to security is easily breached. Make sure that your network operation is accompanied by a security policy that stresses multiple levels of secure access, with protection built in to every server and workstation — something easily accomplished with Linux.
If you are using DSL access or a cable modem, you might have a dynamic IP provided through DHCP, or you might be assigned a static IP. You might automatically be provided with the names of the DNS servers if you use DHCP, or you might have to set up DNS manually (in which case, you have to know the IP addresses of the DNS servers).NOTE
Most IP addresses are dynamically assigned by ISPs; ISPs have a pool of addresses, and you get whatever address is available. From the ISP's viewpoint, a small number of addresses can serve a large number of people because not everyone will be online at the same time. For most Internet services, a dynamic IP works well because it is the ISP's job to route that information to you, and it sits in the middle —between you and the service you want to use. But a dynamic IP address changes, and if someone needs to find you at the same address (if you run a website or a file transfer site, for example), an IP that changes every time you log on will not work well. For that, you need a static IP. Because your ISP cannot reuse that IP with its other customers, it will likely charge you more for a static IP than a dynamic If? The average consumer doesn't need the benefit of a static IP so he is happy paying less for a dynamically assigned IP Also, the DNS information can be provided automatically by the ISP by the DHCP
NOTE
The information in this book will help you understand and avoid many connection issues, but you might experience connection problems. Keep the telephone number of the technical help service for your ISP on hand in case you are not able to establish a connection. But be aware that few ISPs offer Linux support, and you might need to seek help from a Linux-savvy friend or a Linux user's group if your special circumstances cannot be handled from the knowledge you gain from this book. Of course, the best place to look is on the Internet. Use Google's Linux page (http://www.google.com/linux) to research the problem and see whether any other users have found fixes or workarounds.
A DSL connection requires that you have an ethernet network interface card (sometimes a USB interface that is not easily supported in Linux) in your computer or notebook. Many users also configure a gateway, firewall, or other computer with at least two network inter face cards to share a connection with a LAN. We looked at the hardware and protocol issues earlier in this chapter. Advanced configuration of a firewall or router, other than what was addressed during your initial installation of Fedora, is beyond the scope of this book.NOTE
DSL service is an "always-on" type of Internet service, although you can turn off the connection under Fedora by using the Network Device Control, found under System, Administration. An always-on connection exposes your computer to malicious abuse from crackers who trawl the Internet attempting to gain access to other computer systems. In addition to the capability to turn off such connections, Fedora provides a firewall to keep crackers out; you configured a simple firewall during the original installation. The firewall can also be configured from the Security Level Configuration tool found in the System Settings menu selection as Security Level.
NOTE
You can check to see whether PPP is installed on your system by running the pppd command as root from a command line with the --help argument, like this:
# pppd --help
That will list the current version number and describe a few available options if PPP is installed.
If PPP isn't installed on your system, use the rpm command to install the PPP package from the Fedora DVD or use the Packages menu item from the System Settings menu. Chapter 34, "Advanced Software Management," covers the details of using rpm and the graphical package manager.
Begin by copying the scripts from the /usr/share/doc/ppp*/scripts directory to the /etc/ppp directory, like so:CAUTION
Many software modems do not work with Linux because the manufacturers won't release programming information about them or provide Linux drivers. An external serial port modem or ISA bus modem almost always works; USB and PCI modems are still problematic. It is suggested that you do a thorough Google search, using your modem's name and model number, to see how others have solved problems with that particular modem. Links to software modem compatibility sites appear at the end of this chapter.
Set the baud rate (38400 in the default case) to the desired connection speed — most likely 115200 or 57600. When finished, save the file.CAUTION
You can use /dev/modem only if Fedora's kudzu utility has recognized and configured the computer's modem. (If /dev/modem does not exist, use the ln command to create the file as a symbolic link pointing to the correct serial port.) To create the symlink (from /dev/ttyS2, for example):
# ln -s /dev/ttyS2 /dev/modem
If your modem was not automatically detected and the /dev/modem link configured, it is possible that you have a software modem, also known as a Winmodem or HSF modem (refer to the earlier note).
TIP
If your modem is installed and working, you can access it with a terminal program such as minicom, which usually is not installed by default. After you install it using yum or from source code, start it the first time with the -s argument to configure it:
$ minicom -s
Set the serial port to that of your modem, and then save the configuration. You can then use minicom to communicate with your modem by using the AT command to set and see its responses.
If you do not want to go to that trouble, you can use the echo command to send commands to the modem, but the modem won't be capable of responding to you. For example, the AT&W command can be sent as follows:
# echo "AT&W" > /dev/modem
Related Fedora and Linux Commands
You will use these commands when managing network connectivity in your Fedora system:
► dhclient — Automatically acquire, and then set IP info for a NIC
► ethereal — GNOME graphical network scanner
► gnome-lokkit — Fedora's basic graphical firewalling tool for X
► ifconfig — Displays and manages Linux networking devices
► iwconfig — Displays and sets wireless network device parameters
► lokkit — Fedora's basic graphical firewalling tool
► netconfig — Fedora's console-based graphical network interface configuration tool
► route — Displays and manages Linux kernel routing table
► setup — Fedora's console-based graphical management tool
► ssh — The OpenSSH remote-login client and preferred replacement for telnet
► system-config-nfs — Fedora's graphical Network File System configuration tool
► system-config-network — Fedora's graphical network and service management client for X
► system-config-securitylevel — Fedora's graphical firewall configuration utility
Running the w command now shows you as connecting from the external IP address.TIP
Note that the server responds with Welcome to Caitlin, running Fedora, which is a customized message. Your machine will probably respond with Fedora and your kernel version. This is insecure: Giving away version numbers is never a smart move. In fact, even saying Fedora is questionable. Edit the issue and issue.net files in your /etc directory to change these messages.
TIP
For extra security, consider setting PermitRootLogin to no in /etc/ssh/sshd_config. When this is set, it becomes impossible to SSH into your machine using the root account — you must connect with a normal user account and then use su or sudo to switch to root. This is advantageous because most brute-force attempts take place on the root account because it is the only account that is guaranteed to exist on a server. Also, even if a cracker knows your user account, she has to guess both your user password and your root password to take control of your system.
TIP
The configuration files in /etc/xen are in text format and so are easily edited. For example, if you want to change the number of CPUs a VM sees, look for the vcpus setting. Note that these are virtual CPUs rather than real ones — you can set this to 8 and have your guest see eight CPUs, even if your actual machine has just one. This is a great way to test a cluster without going beyond your desktop!
Related Fedora and Xen Commands
The following commands are useful for working with Xen on Fedora:
► virt-manager — Red Hat's new graphical Xen management system
► vncviewer — Lets you connect to the graphical output of a Xen VM
► xend — Starts and stops the Xen daemon without using the service command
► xenguest-install.py — A helpful script that generates configuration files for you
► xm — Lets you manipulate the state of virtual machines while they are running
Web Server | Number | Percentage |
---|---|---|
Apache | 68,155,320 | 47.73% |
Microsoft* | 53,017,735 | 37.13% |
7,763,516 | 5.44% | |
SunONE | 2,262,019 | 1.58% |
lighttpd | 1,515,963 | 1.08% |
Fedora ships with Apache 2.2, and the server (named httpd) is included on this book's CD-ROMs and DVD. You can obtain the latest version of Apache as an RPM installation file from a Fedora FTP server; upgrade using up2date, yum, or apt-get; or get the source code from the Apache website and, in true Linux tradition, build it for yourself.TIP
You'll find an overview of Apache in the Apache Software Foundation's frequently asked questions (FAQs) at http://httpd.apache.org/docs-2.2/faq/. In addition to extensive online documentation, you can also find the complete documentation for Apache in the HTML directory of your Apache server. You can access this documentation by looking at http://localhost/manual/index.html on your new Fedora system with one of the web browsers included on your system. You'll need to have Apache running on your system!
NOTE
Check the Apache site for security reports. Browse to http://httpd.apache.org/security_report.html for links to security vulnerabilities for Apache 1.3, 2.0, and 2.2. Subscribe to a support list or browse through up-to-date archives of all Apache mailing lists at http://httpd.apache.org/mail/ (for various articles) or http://httpd.apache.org/lists.html (for comprehensive and organized archives).
If you want the most recent, experimental version of Apache for testing, check Red Hat's Rawhide distribution, which is also available on the Fedora FTP server (http://download.fedora.redhat.com/pub/fedora/linux/core/development/). This distribution is experimental and always contains the latest versions of all RPMs. However, note that the Apache package might depend on new functionality available in other RPMs. Therefore, you might need to install many new RPMs to be able to use packages from Rawhide. If you still want to use an Apache version from the Rawhide distribution for testing, a better option might be to download the source code RPM (SRPM) and compile it yourself. That way, you avoid dependencies on other new packages.
After you have obtained an Apache RPM, you can install it with the command-line rpm tool by typing the following:CAUTION
You should be wary of installing experimental packages, and never install them on production servers (that is, servers used in "real life"). Very carefully test the pack ages beforehand on a host that isn't connected to a network!
NOTE
If you are upgrading to a newer version of Apache, RPM doesn't write over your current configuration files. RPM moves your current files and appends the extension .rpmnew to them. For example, srm.conf becomes srm.conf.rpmnew.
TIP
As with many software packages distributed in source code form for Linux and other Unix-like operating systems, extracting the source code results in a directory that contains a README and an INSTALL file. Be sure to peruse the INSTALL file before attempting to build and install the software.
TIP
A safer way to install a new version of Apache from source is to use the ln command to create symbolic links of the existing file locations (listed in the "Installing from the RPM" section earlier in this chapter) to the new locations of the files. This method is safer because the default install locations are different from those used when the RPM installs the files. Failure to use this installation method could result in your web server process not being started automatically at system startup.
Another safe way to install a new version of Apache is to first back up any important configuration directories and files (such as /etc/httpd) and then use the rpm command to remove the server. You can then install and test your new version and, if needed, easily restore your original server and settings.
It is strongly recommended that you use Fedora's RPM version of Apache until you really know what happens at system startup. No "uninstall" option is available when installing Apache from source!
A Quick Guide to Getting Started with Apache
Setting up, testing a web page, and starting Apache with Fedora can be accomplished in just a few steps. First, make sure that Apache is installed on your system. Either select it during installation or install the server and related RPM files.
Next, set up a home page for your system by editing (as root) the file named index.html under the /var/http/www/html directory on your system. Make a backup copy of the original page or www directory before you begin so that you can restore your web server to its default state if necessary.
Start Apache (again, as root) by using the service command with the keywords httpd and start, like this:
# service httpd start
You can also use the httpd script under the /etc/rc.d/init.d/ directory, like this:
# /etc/rc.d/init.d/httpd start
You can then check your home page by running a favorite browser and using localhost, your system's hostname, or its Internet Protocol (IP) address in the URL. For example, with the links text browser, use a command line like this:
# links http://localhost/
For security reasons, you shouldn't start and run Apache as root if your host is connected to the Internet or a company intranet. Fortunately, Apache is set to run as the user and group apache no matter how it's started (by the User and Group settings in /etc/httpd/httpd.conf). Despite this safe default, Apache should be started and managed by the user named apache, defined in /etc/passwd as:
apache:x:48:48:Apache:/var/www:/sbin/nologin
After you are satisfied with your website, use the setup (select Services) or ntsysv (select httpd) command to ensure that Apache is started properly.
NOTE
When you build and install Apache from source and don't use Fedora's Apache RPM files, start the server manually from the command line as root (such as when testing). You do this for two reasons:
► The standalone server uses the default HTTP port (port 80), and only the super- user can bind to Internet ports that are lower than 1024.
► Only processes owned by root can change their UID and GID as specified by Apache's User and Group directives. If you start the server under another UID, it runs with the permissions of the user starting the process.
Note that although some of the following examples show how to start the server as root, you should do so only for testing after building and installing Apache. Fedora is set up to run web services as the apache user if you use Fedora RPM files to install Apache.
You can use the /etc/rc.d/init.d/httpd script and the following options to control the web server:NOTE
/etc/rc.d/init.d/httpd is a shell script and isn't the same as the Apache server located in /usr/sbin. That is, /usr/sbin/httpd is the program executable file (the server); /etc/rc.d/init.d/httpd is a shell script that uses another shell script, apachectl, to control the server. See Chapter 11 for a description of some service scripts under /etc/rc.d/init.d and how the scripts are used to manage services such as httpd.
TIP
Use the reload option if you're making many changes to the various server configuration files. This saves time when you're stopping and starting the server by having the system simply reread the configuration files.
Launch this client by using your X desktop panel's Server Settings' HTTP Server menu item or from the command line of an X terminal window, like this:CAUTION
If you use system-config-httpd, you shouldn't try to manually edit the httpd.conf file. Manual changes are overwritten by the GUI client if you again use system-config-httpd!
TIP
After installing and starting Apache, you'll find an index of directives at http://localhost/manual/mod/directives.html.
TIP
If you find a user on your system (other than root) with a UID and GID of 0, your system has been compromised by a malicious user.
NOTE
Other MPMs are available for Apache related to other platforms, such as mpm_netware for NetWare hosts and mpm_winnt for Windows NT platforms. An MPM named perchild, which provides user ID assignment to selected daemon processes, is under development. For more information, browse to the Apache Software Foundation's home page athttp://www.apache.org/.
Switch | Description |
---|---|
None | None of the available options are enabled for this directory. |
All | All the available options, except for MultiViews, are enabled for this directory. |
Indexes | In the absence of an index.html file or another DirectoryIndex file, a listing of the files in the directory is generated as an HTML page for display to the user. |
Includes | Server-side includes (SSIs) are permitted in this directory. This can also be written as IncludesNoExec if you want to allow includes but don't want to allow the exec option in them. For security reasons, this is usually a good idea in directories over which you don't have complete control, such as UserDir directories. |
FollowSymLinks | Allows access to directories that are symbolically linked to a document directory. You should never set this globally for the whole server and only rarely for individual directories. This option is a potential security risk because it allows web users to escape from the document directory and could potentially allow them access to portions of your file system where you really don't want people poking around. |
ExecCGI | CGI programs are permitted in this directory, even if it isn't a directory defined in the ScriptAlias directive. |
MultiViews | This is part of the mod_negotiation module. When a client requests a document that can't be found, the server tries to figure out which document best suits the client's requirements. See http://localhost/manuals/mod/_mod_negotiation.html for your local copy of the Apache documentation. |
NOTE
These directives also affect all subdirectories of the specified directory.
Switch | Description |
---|---|
Options | The .htaccess file can add options not listed in the Options directive for this directory. |
FileInfo | The .htaccess file can include directives for modifying document type information. |
AuthConfig | The .htaccess file might contain authorization directives. |
Limit | The .htaccess file might contain allow, deny, and order directives. |
CAUTION
Allowing individual users to put web content on your server poses several important security risks. If you're operating a web server on the Internet rather than on a private network, you should read the WWW Security FAQ at http://www.w3.org/Security/Faq/ www-security-faq.html.
To create a user file for Apache, use the htpasswd command. This is included with the Apache package. If you installed with the RPMs, it is in /usr/bin. Running htpasswd without any options produces the following output:CAUTION
Don't use /etc/passwd as a user list for authentication. When you're using Basic Authentication, passwords and usernames are sent as base 64-encoded text from the client to the server — which is just as readable as plain text. The username and pass word are included in each request that is sent to the server. So anyone who might be snooping on Net traffic would be able to get this information!
TIP
See http://localhost/manual/misc/rewriteguide.html for a cookbook that gives you an in-depth explanation of what the mod_rewrite module is capable of.
Name-based virtual hosts require just one step more than IP address-based virtual hosts. You must first indicate which IP address has the multiple DNS names on it. This is done with the NameVirtualHost directive:NOTE
Some older browsers are unable to see name-based virtual hosts because this is a feature of HTTP 1.1 and the older browsers are strictly HTTP 1.0-compliant. However, many other older browsers are partially HTTP 1.1-compliant, and this is one of the parts of HTTP 1.1 that most browsers have supported for a while.
For more information about VirtualHost, refer to the help system on http://localhost/_manual.TIP
If you're hosting websites on an intranet or internal network, users are likely to use the shortened name of the machine rather than the FQDN. For example, users might type http://bugserver/index.html in their browser location fields rather than http://bugserver.gnulix.org/index.html. In that case, Apache would not recognize that those two addresses should go to the same virtual host. You could get around this by setting up VirtualHost directives for both bugserver and bugserver.gnulix.org, but the easy way around it is to use the ServerAlias directive, which lists all valid aliases for the machine:
ServerAlias bugserver
%a | Remote IP address. |
%A | Local IP address. |
%b | Bytes sent, excluding HTTP headers. This is shown in Apache's Combined Log Format (CLF). For a request without any data content, a - is shown instead of 0. |
%B | Bytes sent, excluding HTTP headers. |
%{VARIABLE}e | The contents of the environment variable variable. |
%f | The filename of the output log. |
%h | Remote host. |
%H | Request protocol. |
%{HEADER}i | The contents of header; header line(s) in the request sent to the server. |
%l | Remote log name (from identd, if supplied). |
%m | Request method. |
%{NOTE}n | The contents of note NOTE from another module. |
%{HEADER}o | The contents of header; header line(s) in the reply. |
%p | The canonical port of the server serving the request. |
%P | The process ID of the child that serviced the request. |
%q | The contents of the query string, prepended with a ? character. If there's no query string, this evaluates to an empty string. |
%r | The first line of request. |
%s | Status. For requests that were internally redirected, this is the status of the original request — %>s for the last. |
%t | The time, in common log time format. |
%{format}t | The time, in the form given by format, which should be in strftime(3) format. |
%T | The seconds taken to serve the request. |
%u | Remote user from auth; this might be bogus if the return status (%s) is 401. |
%U | The URL path requested. |
%V | The server name according to the UseCanonicalName directive. |
%v | The canonical ServerName of the server serving the request. |
Related Fedora and Linux Commands
You will use these commands when managing your Apache web server in Fedora:
► apachectl — Server control shell script included with Apache
► system-config-httpd — Red Hat's graphical web server configuration tool
► httpd — The Apache web server
► konqueror — KDE's graphical web browser
► elinks — A text-based, graphical menu web browser
► firefox — The premier open source web browser
TIP
SQL has a number of reserved keywords that cannot be used in table names or field names. For example, if you keep track of CDs you want to take with you on vacation, you would not be able to use the field name select because that is a reserved keyword. Instead, you should either choose a different name (selected?) or just prefix the field name with an f, such as fselect.
SQL is capable of far more than is demonstrated here. But as mentioned before, this section is not intended to teach you all there is to know about SQL programming; rather, it teaches you the basics so that you can be a more effective DBA.TIP
One of the most common errors among new database programmers is confusing logical AND and logical OR. For example, in everyday speech, you might say "Find me all CDs released in 2003 and 2004." At first glance, you might think that if you fed this statement to the database in SQL format, it would return the rows for For All You've Done and Life for Rent. In fact, it would return no rows at all. This is because the data base interprets the statement as "Find all rows in which the CD was released in 2003 and was released in 2004." It is, of course, impossible for the same CD to be released twice, so this statement would never return any rows, no matter how many CDs were stored in the table. The correct way to form this statement is with an OR statement instead of an AND statement.
NOTE
MySQL's data locking methods are discussed in more depth at http://www.mysql.com/doc/en/Internal_locking.html.
You can find more information on PostgreSQL's locking at http://www.postgresql.org/docs/7.4/interactive/sql-lock.html.
Running mysql_install_db should generate output similar to the following:CAUTION
The MySQL data directory needs to be owned by the user as which MySQL will run (use the chown command to change ownership). In addition, only this user should have any permissions on this directory. (In other words, use chmod to set the permissions to 700.) Setting up the data directory any other way creates a security hole.
CAUTION
By default, the MySQL root user is created with no password. This is one of the first things you must change because the MySQL root user has access to all aspects of the database. The following section explains how to change the password of the user.
To add a user account, you connect to the database by typing mysql -u root -p and pressing Enter. You are then connected as the root user and prompted for a password. (You did set a password for the root user as instructed in the last section, right?) After you enter the root password, you are placed at the MySQL command prompt.NOTE
Listing all the available privileges is beyond the scope of this chapter. See the MySQL documentation for more information.
Later, if you need to revoke privileges from foobar, you can use the REVOKE statement. For example, the following statement revokes all privileges from the user foobar:NOTE
See the section "The MySQL Command-Line Client" later in this chapter for additional command-line options.
You can start the postmaster program with the following command (make sure that you are still the user postgres):CAUTION
The initdb program sets the permissions on the data directory to 700. You should not change these permissions to anything else to avoid creating a security hole.
TIP
By default, Fedora makes the PostgreSQL data directory /var/lib/pgsql/data. This isn't a very good place to store the data, however, because most people do not have the necessary space in the /var partition for any kind of serious data storage. Note that if you do change the data directory to something else (such as /usr/local/pgsql/data, as in the examples in this section), you need to edit the PostgreSQL startup file (named postgres) located in /etc/rc.d/init.d to reflect the change.
CAUTION
PostgreSQL allows you to omit the with password portion of the statement. However, doing so causes the user to be created with no password. This is a security hole, so you should always use the with password option when creating users.
NOTE
When you are finished working in the psql command-line client, you can type \q to get out of it and return to the shell prompt.
NOTE
You should consider access and permission issues when setting up a database. Should users be able to create and destroy databases? Or should they only be able to use existing databases? Will users be able to add records to the database and modify existing records? Or should users be limited to read-only access to the database? And what about the rest of the world? Will the general public need to have any kind of access to your database through the Internet? As DBA, you must determine the answers to these questions.
Option | Action |
---|---|
-h hostname | Connects to the remote host hostname (if the database server isn't located on the local system). |
-u username | Connects to the database as the user username. |
-p | Prompts for a password. This option is required if the user as whom you are connecting needs a password to access the database. Note that this is a lowercase p. |
-P n | Specifies n as the number of the port to which the client should connect. Note that this is an uppercase P. |
-? | Displays a help message. |
You can access the MySQL server without specifying a database to use. After you log in, you use the help command to get a list of available commands, like this:CAUTION
Although mysql enables you to specify the password on the command line after the -p option, and thus enables you to avoid having to type the password at the prompt, you should never invoke the client this way. Doing so causes your password to display in the process list, and the process list can be accessed by any user on the system. This is a major security hole, so you should never give your password on the mysql command line.
Option | Action |
---|---|
-h hostname | Connects to the remote host hostname (if the database server isn't located on the local system). |
-p n | Specifies n as the number of the port to which the client should connect. Note that this is a lowercase p. |
-U username | Connects to the database as the user username. |
-W | Prompts for a password after connecting to the database. In PostgreSQL 7 and later, password prompting is automatic if the server requests a password after a connection has been established. |
-? | Displays a help message. |
The following commands are useful for creating and manipulating databases in Fedora:Related Fedora and Database Commands
► createdb — Creates a new PostgreSQL database
► createuser — Creates a new PostgreSQL user account
► dropdb — Deletes a PostgreSQL database
► dropuser — Deletes a PostgreSQL user account
► mysql — Interactively queries the mysqld server
► mysqladmin — Administers the mysqld server
► mysqldump — Dumps or backs up MySQL data or tables
► pgaccess — Accesses a PostgreSQL database server
► pg_ctl — Controls a PostgreSQL server or queries its status
► psql — Accesses PostgreSQL via an interactive terminal
Option | Purpose |
---|---|
rw | Gives read and write access |
ro | Gives read-only access |
async | Writes data when the server, not the client, feels the need |
sync | Writes data as it is received |
NOTE
As part of your configuration for using NFS, you might need to enable the port on your firewall. Go to System, Administration, Firewall to open the Firewall configuration utility. Check the box next to NFS4 and click Apply to apply the new firewall policy.
The options column uses the same options as standard fstab file entries with some additional entries, such as nfsvers=4, which specifies the fourth version of NFS. You can also use the mount command, as root, to quickly attach a remote directory to a local file system by using a remote host's name and exported directory. For example:NOTE
If you use autofs on your system, you need to use proper autofs entries for your remote NFS mounts. See the section 5 man page for autofs.
NOTE
Depending on your needs, smb.conf can be a simple file of fewer than 20 lines or a huge file spanning many pages of text. If your needs are complex, I suggest picking up a copy of Using Samba, 3rd Edition by Carter, Ts, and Eckstein (O'Reilly, 2007).
First, click the GLOBALS icon in SWAT's main page. You see a page similar to the one shown in Figure 19.5. Many options are in the window, but you can quickly set up access for hosts from your LAN by simply entering one or more IP addresses or a subnet address (such as 192.168.0. — note the trailing period, which allows access for all hosts; in this example, on the 192.168.0 subnet) in the Hosts Allow field under the Security Options section. If you need help on how to format the entry, click the Help link to the left of the field. A new web page appears with the pertinent information.TIP
You can also configure Samba with Fedora's system-config-samba client. Launch the client from the command line of an X terminal window or select the System, Administration, Samba menu item (as shown later in Figure 19.10).
When finished, click the Add New User button. SWAT then creates the username and password and displays Added user username (where username is the name you entered). The new Samba user should now be able to gain access to the home directory from any allowed host if the Samba (smb) server is running.NOTE
You must supply a username of an existing system user, but the password used for Samba access does not have to match the existing user's password.
Option | Result |
---|---|
-b | Brief output. |
-d | Verbose output. |
-s /path/to/config | Used if the configuration file used at startup is not the standard one. |
-u username | Shows the status of a specific user's connection. |
-p | Lists current smb processes. This can be useful in scripts. |
This command mounts ahudson's home directory on your host and gives all users full permissions to the mount. The permissions are equal to the permissions on the chmod command.NOTE You can substitute a hostname for an IP address if your name service is running or the host is in your /etc/hosts file.
If the computer with an attached printer is using Fedora and you want to set up the system for print serving, again use the system-config-printer client. You can create a new printer, but the easiest approach is to publish details of your printer across the network.TIP
LPRng, like CUPS, can be configured to restrict print services to single hosts, one or more specific local or remote users, all or part of a domain, or a LAN segment (if you specify an IP address range). An entry in /etc/lpd.perms, for example, to allow print requests only from hosts on 192.168.2.0, would look like this:
ACCEPT SERVICE=X REMOTEIP=192.168.2.0/255.255.255.0
The lpd.perms man page (included as part of the LPRng documentation) contains an index of keywords you can use to craft custom permissions. Don't forget to restart the lpd daemon after making any changes to /etc/lpd.perms (or /etc/lpd.conf).
When finished, click the Apply button and then select Quit from the Action menu to exit.TIP
If you will share your CUPS-managed printer with other Linux hosts on a LAN using the Berkeley-type print spooling daemon, lpd, check the Enable LPD Protocol item under the Sharing dialog box's General tab. Next, check that the file cups-lpd under the /etc/xinetd.d directory contains the setting disable = no and then restart xinetd. This enables CUPS to run the cups-lpd server and accept remote print jobs sent by lpd from remote hosts. Do not forget to save your changes and restart CUPS!
Click the Forward button after entering this information; then continue to configure the new entry as if the remote printer were attached locally (use the same print driver setting as the remote printer). When finished, do not forget to save the changes!NOTE
Browse to http://www.faqs.org/rfcs/rfc1179.html to read more about using the Strict RFC 1179 Compliance option when configuring Fedora to be able to print to a remote UNIX printer. This 13-year-old Request For Comments (RFC) document describes printing protocols for the BSD line-printer spooling system. The option is used to allow your documents to print to remote servers using the older print system or software conforming to the standard.
TIP
Curiously, NETGEAR does not promote the PS101 as Linux-supported hardware even though it works. Other types of network-attached print devices include Bluetooth- enabled printers and 802.11b wireless ethernet print servers such as TRENDnet's TEW-PS3, HP/Compaq's parallel-port-based WP 110, and the JetDirect 380x with USB. As always, research how well a product, such as a printer or print server, works with Linux before purchasing!
NOTE
To learn more about CUPS and to get a basic overview of the system, browse to http://www.cups.org/.
The following commands help you manage printing services:
► accept — Controls print job access to the CUPS server via the command line
► cancel — Cancels a print job from the command line
► disable — Controls printing from the command line
► enable — Controls CUPS printers
► lp — Sends a specified file to the printer and allows control of the print service
► lpc — Displays the status of printers and print service at the console
► lpq — Views print queues (pending print jobs) at the console
► lprm — Removes print jobs from the print queue via the command line
► lpstat — Displays printer and server status
► system-config-printer — Displays Fedora's graphical printer configuration tool
► system-config-printer-tui — Displays Fedora's text-dialog printer configuration tool
NOTE
Many Linux users now use OpenSSH and its suite of clients, such as the sftp command, for a more secure solution when transferring files. The OpenSSH suite provides the sshd daemon and enables encrypted remote logins (see Chapter 15 for more information).
Another FTP server package for Linux is ProFTPD, licensed under the GNU GPL. This server works well with most Linux distributions and has been used by a number of Linux sites, including ftp.kernel.org and ftp.sourceforge.net. ProFTPD is actively maintained and updated for bug fixes and security enhancements. Its developers recommend that you use the latest release (1.2.10 at the time of this writing) to avoid exposure to exploits and vulnerabilities. Browse to http://www.proftpd.org to download a copy.NOTE
Do not confuse the ncftp client with ncftpd. The ncftp-3.1.7-4 package included with Fedora is the client software, a replacement for ftp-0.17-22, and includes the ncftpget and ncftpput commands for transferring files via the command line or with a remote file uniform resource locator address. ncftpd is the FTP server, which can be downloaded from www.ncftpd.com.
Because the anonftp and wu-ftpd RPM packages are not included with Fedora, you must download and install them if you want to use the wu-ftpd server. Retrieve the most recent packages for Linux from http://www.wu-ftpd.org/ to build from the latest source code or obtain RPM packages from a reputable mirror.NOTE
If you host an FTP server connected to the Internet, make it a habit to always check the Fedora site, http://fedora.redhat.com, for up-to-date system errata and security and bug fixes for your server software.
This entry follows the standard /etc/passwd entry: username, password, user ID, group ID, comment field, home directory, and shell. To learn more about /etc/password, see the section "The Password File" in Chapter 10, "Managing Users."NOTE
The FTP user, as discussed here, applies to anonymous FTP configurations and server setup.
Also, note that other Linux distributions might use a different default directory, such as /usr/local/ftp, for FTP files and anonymous users.
Quick and Dirty FTP Service
Conscientious Linux administrators take the time to carefully install, set up, and configure a production FTP server before offering public service or opening up for business on the Internet. However, you can set up a server very quickly on a secure LAN by following a few simple steps:
1. Ensure that the FTP server RPM package is installed, networking is enabled, and firewall rules on the server allow FTP access. See Chapter 14, "Networking," to see how to use Red Hat's system-config-securitylevel client for firewalling.
2. If anonymous access to server files is desired, populate the /var/ftp/pub directory. Do this by mounting or copying your content, such as directories and files, under this directory.
3. Edit and then save the appropriate configuration file (such as vsftpd.conf for vsftpd) to enable access.
4. If you are using wu-ftpd, you must start or restart xinetd like so: /etc/rc.d/init.d/xinetd restart. If you are using vsftpd, you must start or restart the server like so: service vsftpd start.
NOTE
Do not be confused by the first line of the wu-ftpd file's text. Even though the line reads default: on, FTP service is off unless you specifically configure its use. The line is a comment because it begins with a pound sign (#) and is ignored by xinetd. Whether FTP service is on is determined by the text line disable = yes.
TIP
You can also use the shell script named vsftpd under the /etc/rc.d/init.d directory to start, stop, restart, and query the vsftpd server. You must have root permission to use the vsftpd script to control the server, but any user can query the server (to see whether it is running and to see its process ID number) using the status keyword like this:
$ /etc/rc.d/init.d/vsftpd status
TIP
Before editing the FTP server files, make a backup file first. Also, it is always a good idea to comment out (using a pound sign at the beginning of a line) what is changed instead of deleting or overwriting entries. Follow these comments with a brief description explaining why the change was made. This leaves a nice audit trail of what was done, by whom, when, and why. If you have any problems with the configuration, these comments and details can help you troubleshoot and return to valid entries if necessary. You can use the rpm command or other Linux tools (such as mc) to extract a fresh copy of a configuration file from the software's RPM archive. Be aware, however, that the extracted version replaces the current version and overwrites your configuration changes.
Another default setting is that specific user login controls are not set, but you can configure the controls to deny access to one or more users.NOTE
Browse to http://slacksite.com/other/ftp.html for a detailed discussion regarding active and passive FTP modes and the effect of firewall blocking of service ports on FTP server and client connections.
CAUTION
When configuring an anonymous FTP server, it is extremely important to ensure that all security precautions are taken to prevent malicious users from gaining privileged-level access to the server. Although this chapter shows you how to configure your FTP server for secure use, all machines connected to the Internet are potential targets for malicious attacks. Vulnerable systems can be a source of potential liability, especially if anyone accesses and uses them to store illegal copies of proprietary software — even temporarily. There is little value in configuring a secure FTP server if the rest of the system is still vulnerable to attack. Use Red Hat's lokkit or system-config-securitylevel client to implement a firewall on your system.
You can edit the ftpaccess file at the command line to make configuration changes in any of these categories. The following sections describe some configuration changes and how to edit these files to accomplish them.TIP
Many more options can be specified for the wu-ftpd FTP server in its ftpaccess file. The most common commands have been covered here. A full list of configuration options can be found in the ftpaccess man page after you install the server.
ftpusers File Purpose Now Implemented in ftpaccess
Certain accounts for the system to segment and separate tasks with specific permissions are created during Linux installation. The ftpusers file (located in /etc/ftpusers) is where accounts for system purposes are listed. It is possible that the version of wu-ftp you use with Fedora deprecates the use of this file, and instead implements the specific functionality of this file in the ftpaccess file with the commands of deny-uid/deny-gid.
NOTE
Note that the banner does not replace the greeting text that, by default, displays the hostname and server information, such as:
220 shuttle2 FTP server (Version wu-2.6.2-8) ready.
To hide version information, use the greeting command in ftpaccess with a keyword, such as terse, like so:
greeting terse
FTP users then see a short message like this as part of the login text:
220 FTP server ready.
Also, not all FTP clients can handle multiline responses from the FTP server. The banner <path> command is what the banner line uses to pass the file contents to the client. If clients cannot interrupt multiline responses, the FTP server is useless to them. You should also edit the default banner to remove identity and version information.
Cookie | Description |
---|---|
%T | Local time (form Thu Nov 15 17:12:42 1990) |
%F | Free space in partition of CWD (kilobytes) [Not supported on all systems] |
%C | Current working directory |
%E | Maintainer's email address as defined in ftpaccess |
%R | Remote hostname |
%L | Local hostname |
%u | Username as determined via RFC931 authentication |
%U | Username given at login time |
%M | Maximum allowed number of users in this class |
%N | Current number of users in this class |
%B | Absolute limit on disk blocks allocated |
%b | Preferred limit on disk blocks |
%Q | Current block count |
%I | Maximum number of allocated inodes (+1) |
%i | Preferred inode limit |
%q | Current number of allocated inodes |
%H | Time limit for excessive disk use |
%h | Time limit for excessive files |
Ratios | |
%xu | Uploaded bytes |
%xd | Downloaded bytes |
%xR | Upload/download ratio (1:n) |
%xc | Credit bytes |
%xT | Time limit (minutes) |
%xE | Elapsed time since login (minutes) |
%xL | Time left |
%xU | Upload limit |
%xD | Download limit |
CAUTION
Do not use your live email address in the display banner; you want others to be able to access user emails as necessary. Instead, use an alias address that routes the messages to the appropriate IT department or other address.
NOTE
By default, all the ftpaccess file command lines prohibit anonymous users from executing actions and enable authorized users to do so.
Cookie | Description |
---|---|
%s | The time the system will be shut down |
%r | The time new connections will be denied |
%d | The time current connections will be dropped |
Examples
Several conversion rules may be specified in wu-ftpd's default ftpconversions file. Additional examples of conversion rules, such as for Sun's Solaris operating system, might be available in the wu-ftpd documentation.
Name | Description |
---|---|
Process ID | The process ID of the FTP server process. |
TTY | The terminal ID of the process. This is always a question mark (?) because the FTP daemon is not an interactive login. |
Status | The status of the FTP process. The values are: |
S: Sleeping | |
Z: Zombie, indicating a crash | |
R: Running | |
N: Normal process | |
Time | The elapsed processor time the process has used in minutes and seconds. |
Details | Tells from what host the process is connecting, the user who connected, and the currently executing command. |
Cookie | Description |
---|---|
%s | Time the system will be shut down |
%r | Time new connections will be denied |
%d | Time current connections will be dropped |
%C | Current working directory |
%E | Server administrator's email address as specified in the ftpaccess file |
%F | Available free space in the current working directories partition, in kilobytes |
%L | Local host time |
%M | Maximum number of allowed connections in this user class |
%N | Current number of connections for this user class |
%R | Remote hostname |
%T | Local time, in the form of Fri Aug 31 21:04:00 2001 |
%U | Username given at login |
Field | Description |
---|---|
current-time | Current local time in the form of DDD MMM dd hh:mm:ss YYYY, where DDD is the day of the week, MMM is the month, dd is the day of the month, hh is the hour, mm is the minutes, ss is the seconds, and YYYY is the year. |
transfer-time | Total time in seconds for the transfer. |
remote-host | Remote hostname. |
file-size | Size of the transferred file in bytes. |
filename | Name of the file. |
transfer-type | A single character indicating the transfer type. The types are: |
a for ASCII transfers, | |
b for binary transfers | |
special-action-flag | One or more character flags indicating any special action taken by the server. The values are: |
C for compressed files | |
U for uncompressed files | |
T for TARed files | |
- for no special action taken | |
direction | Indicates whether the file was sent from or received by the server. |
access-mode | The way in which the user logged in to the server. The values are: |
a for an anonymous guest user | |
g for a guest user, corresponding to the guestgroup command in the /etc/ftpaccess file | |
r for a real user on the local machine | |
username | If logged in as a real user, the username. If the access mode was guest, the password is given. |
service-name | The name of the service used, usually FTP |
authentication-method | Type of authentication used. The values are: |
0 for none | |
1 for RFC931 authentication (a properly formed email address) | |
authenticated-user-id | This is the user ID returned to the server based on the authentication method used to access the server. An * is used when an authenticated user ID cannot be found. |
completion-status | A single-character field indicating the status of the transfer. The values are: |
c for a completed transfer | |
i for an incomplete transfer |
Related Fedora and Linux Commands
You use these commands to install, configure, and manage FTP services in Fedora:
► epiphany — A graphical GNOME browser supporting FTP
► ftp — A text-based interactive FTP command
► ftpcopy — Copy directories and files from an FTP server
► ftpcp — Retrieve data from a remote FTP server, but do not overwrite existing local files
► gftp — A graphical FTP client for GNOME
► konqueror — KDE's graphical web browser
► lftp — An advanced text-based FTP program
► nautilus — Red Hat's graphical file explorer and browser
► ncftp — A sophisticated, text-based FTP program
► sftp — Secure file transfer program
► smbclient — Samba FTP client to access SMB/CIFS resources on servers
► system-config-services — Red Hat's system service GUI admin utility
► vsftpd — The Very Secure FTP daemon
► webcam — A webcam-oriented FTP client included with xawtv
For enhanced security, many Postfix processes used to use the chroot facility (which restricts access to only specific parts of the file system) for improved security, and there are no setuid components in Postfix. With the current release of Fedora, a chroot configuration is no longer used and is, in fact, discouraged by the Postfix author. You can manually reconfigure Postfix to a chroot configuration, but that is no longer supported by Fedora.CAUTION
Fedora provides Postfix version 2.4, which uses a slightly different configuration than the earlier version. If you are upgrading Postfix from an earlier Fedora or Red Hat version, check your configuration files.
Fedora also now compiles Postfix and Sendmail against version 2.1 of the Cyrus SASL library (an authentication library). The Release Notes contain detailed information on file location and option changes that affect you if you use these libraries.
MDIR Versus Mailbox
Qmail also introduced maildir, which is an alternative to the standard UNIX method of storing incoming mail. maildir is a more versatile system of handling incoming email, but it requires your email clients to be reconfigured, and it is not compatible with the traditional UNIX way of storing incoming mail. You have to use mail programs that recognize the maildir format. (Modern programs do.)
The traditional mbox format keeps all mail assigned to a folder concatenated as a single file and maintains an index of individual emails. With maildir, each mail folder has three subfolders: /cur, /new, and /tmp. Each email is kept in a separate, unique file. If you are running a mail server for a large number of people, you should select a file system that can efficiently handle a large number of small files. mbox does have one major disadvantage. While you are accessing the monolithic mbox file that contains all your email, suppose that some type of corruption occurs, either to the file itself or to the index. Recovery from this problem can be difficult. The mbox files are especially prone to problems if the files are being accessed over a network and can result in file corruption; you should avoid accessing mbox mail mounted over NFS, the network file system, because sudden connection loss can seriously corrupt your mbox file.
Depending on how you access your mail, maildir does permit the simultaneous access of maildir files by multiple applications; mbox does not.
The choice of a mail user agent, or email client, also affects your choice of mail directory format. For example, the pine program does not cache any directory information and must reread the mail directory any time it accesses it. If you are using pine, maildir would be a poor choice. More advanced email clients perform caching, so maildir might be a good choice, although the email client cache can get out of synchronization. It seems that there is no perfect choice.
Fedora provides you with mail alternatives that have both strong and weak points. Be aware of the differences among the alternatives and frequently reevaluate your selection to make certain that it is the best one for your circumstances.
The MDA uses the POP3 or IMAP protocols for this process. In a manner similar to a post office box at the post office, POP3 and IMAP implement a "store and forward" process that alleviates the need to maintain a local mail server if all you want to do is read your mail. For example, dialup Internet users can intermittently connect to their ISPs' mail servers to retrieve mail by using Fetchmail — the MDA provided by Fedora (see the section "Using Fetchmail to Retrieve Mail," later in this chapter).NOTE
Procmail and Spamassassin are examples of MTAs; both provide filtering services to the MTA while they store messages locally and then make them available to the MUA or email client for reading by the user.
Complicated email server setup is beyond the scope of this book; for more information on this topic, we suggest Sendmail, 3rd Edition by Costales and Allman, a 1,200-page comprehensive tome on Sendmail configuration. However, the following five sections address some commonly used advanced options.NOTE
sendmail.cf has some strange syntax because of the requirements of the m4 macro processor. You do not need to understand the details of m4 here, but note the quoting system. The starting quote is a backtick (`), and the ending quote is simply a single quote ('). Also, the dnl sequence means to "delete to new line" and causes anything from the sequence up to and including the newline character to be deleted in the output.
Here's a look at an excerpt from the sendmail.cf file:
CP.
# "Smart" relay host (may be null)
DS
# operators that cannot be in local usernames (i.e., network indicators)
CO @ % !
# a class with just dot (for identifying canonical names)
C..
# a class with just a left bracket (for identifying domain literals) C[[
# access_db acceptance class
C{Accept}OK RELAY
C{ResOk}OKR
# Hosts for which relaying is permitted ($=R)
FR-o /etc/mail/relay-domains
And here's a quote from the sendmail.mc file for comparison:
dnl define(`SMART_HOST',`smtp.your.provider')
define(`confDEF_USER_ID',``8:12'')dnl
undefine(`UUCP_RELAY')dnl
undefine(`BITNET_RELAY')dnl
dnl define(`confAUTO_REBUILD')dnl
define(`confTO_CONNECT', 4m')dnl
define(`confTRY_NULL_MX_LIST',true)dnl
You can see why the file is described as cryptic.
TIP
If you use networking over a modem, there is a configuration file for pppd called ppp.linkup, which is located in /etc/ppp. Any commands in this file are automatically run each time the PPP daemon is started. You can add the line sendmail -q to this file to have your mail queue automatically processed each time you dial up your Internet connection.
TIP
Fedora also provides an alternative to using awk to rebuild the Sendmail configuration. As root, execute the following:
# make -C /etc/mail
CAUTION
You need a very good reason to relay mail; otherwise, do not do it. Allowing all domains to relay through you makes you a magnet for spammers who want to use your mail server to send spam. This could lead to your site being blacklisted by many other sites, which then will not accept any mail from you or your site's users — even if the mail is legitimate!
Any time you make a change to the /etc/mail/aliases file, you have to rebuild the aliases database before that change takes effect. This is done with the following:CAUTION
Reading email as root is a security hazard; a malicious email message can exploit an email client and cause it to execute arbitrary code as the user running the client. To avoid this danger, you can forward all of root's mail to another account and read it from there. You can choose one of two ways for doing this.
You can add an entry to the /etc/mail/aliases file that sends root's mail to a different account. For example, root: foobar would forward all mail intended for root to the account foobar.
The other way is to create a file named .forward in root's home directory that contains the address to which the mail should forward.
Option | Action |
---|---|
OK | Accepts mail from this site, overriding any rules that would reject mail from this site. |
RELAY | Allows this domain to relay through the server. |
REJECT | Rejects mail from this site and sends a canned error message. |
DISCARD | Simply discards any message received from the site. |
ERROR: "n message" | Sends an error message back to the originating server, where n is an RFC 821-compliant error code number. The message itself can be anything you want. |
spam.com REJECTNOTE
For a more personal example of why you would bother to do this, I find that I get a lot of spam from the Hotmail domain, so I would just as soon reject it all. However, my wife uses a Hotmail account for her mail. If I did not allow her mail through, that would be a problem for me.
Unfortunately, many MUAs do not know anything about POP3 or IMAP. To eliminate that problem, you can use a program called Fetchmail to contact mail servers using POP3 or IMAP, download mail off the servers, and then inject those messages into the local MTA just as if they had come from a standard SMTP server. The following sections explain how to install, configure, and use the Fetchmail program.NOTE
Remember when we said that some mail clients can include some MTA functionality? Microsoft Outlook and Outlook Express can be configured to use SMTP and, if you use a dialup connection, offer to start the connection and then use SMTP to send your mail. Therefore, a type of MTA functionality is included in those mail clients.
CAUTION
The .fetchmailrc file is divided into three different sections: global options, mail server options, and user options. It is important that these sections appear in the order listed. Do not add options to the wrong section. Putting options in the wrong place is one of the most common problems that new users make with Fetchmail configuration files.
CAUTION
Because the .fetchmailrc file contains your mail server password, it should be readable only by you. This means that it should be owned by you and should have permissions no greater than 600. Fetchmail complains and refuses to start if the .fetchmailrc file has permissions greater than this.
NOTE
Autoresponders automatically generate replies to received messages; they are commonly used to notify others that the recipient is out of the office. Mercifully, Fedora does not include one, but you can find and install an autoresponder at Freshmeat.net. If you subscribe to a mailing list, be aware that automatic responses from your account can be very annoying to others on the list. Please unsubscribe from mail lists before you leave the office with your autoresponder activated.
Relevant Fedora and Linux Commands
You will use the following commands to manage electronic mail in Fedora:
► balsa — A GNOME mail user agent for X
► biff — A console-based mail notification utility
► evolution — A comprehensive and capable Ximian GNOME mail PIM for X
► fetchmail — A console-based and daemon-mode mail retrieval command for Linux
► fetchmailconf — A graphical Fetchmail configuration client for X
► kmail — A graphical mail user client for KDE and X
► korn — A biff applet for KDE and X
► mail — A console-based mail user agent
► mutt — A console-based mail user agent
► sendmail — A comprehensive mail transport agent for UNIX and Linux
► xbiff — A mail notification X client
The acl lines make up your access control lists. The first 16 or so lines define the minimum recommended configuration for setting up which ports to listen to, and other fairly standard configuration settings that you can safely ignore. If you scroll down farther (past another short block of comments), you come to the http_access lines, which are combined with the acl lines to dictate who can do what. You can (and should) mix and match acl and http_access lines to keep your configuration file easy to read.NOTE
The default port for Squid is 3128, but you can change that by editing the http_port line. Alternatively, you can have Squid listen on multiple ports by having multiple http_port lines: 80, 8000, and 8080 are all popular ports for proxy servers.
Notice that there are two http_access lines for the newssites category: one for worktime and one for freetime. All the conditions must be matched for a line to be matched. The alternative would be to write this:NOTE
The letter D is equivalent to MTWHF in meaning "all the days of the working week."
NOTE
It is critical that you run the command kill -SIGHUP and provide it the process ID of your Squid daemon each time you change the configuration; without this, Squid does not reread its configuration files.
Despite these precautions, the load on DNS servers would be crushing without the extensive use of local caches. As mentioned before, nameservers are allowed to cache the results of queries and intermediate referrals for some time so that they can serve repeated requests for data without referring to the source each time. If they did not do this, root nameservers (and the nameservers for other popular zones) would be contacted by clients all over the world for every name lookup, wasting enormous resources.NOTE
As a DNS administrator, it is your responsibility to ensure that your nameservers provide sufficient redundancy for your zones. Your slaves should be far away from the master so that power failures, network outages, and other catastrophes do not affect your name service.
Ad Blocking with a Caching Nameserver
Another advantage of setting up a caching nameserver is that you can use it to block ads and objectionable sites by using bogus DNS zones to block specific domains. You do this by overriding the DNS lookup of the sites you want to block. Configuration is simple. First, determine the sites that you want to block. For example, you might want to block all access to doubleclick.net. Create an entry in /etc/named.conf like this:
zone "doublelick.net" { type master; file "fakes"; };
Then create a new /var/named/fakes file. This should contain
$TTL 1D
@ IN SOA dns.companyname.com. hostmaster.companyname.com. (
2004081701 8H 2H 4W 1D)
@ IN NS dns.companyname.example.com.
@ IN A 127.0.0.1
* IN A 127.0.0.1
where dns.companyname.com should be replaced by the hostname of the caching nameserver. This points all DNS lookups of doubleclick.net to 127.0.0.1, where they will not be found. To make the change effective, you have to restart named so that the new configuration information is read. Chapter 11 describes several different ways of restarting the named service; here is one of them:
# kill -HUP `pidof named`
When named is restarted, attempts to resolve all doubleclick.net addresses fail, the ads are neither loaded nor displayed, and your browsing experience is faster.
In this chapter, we discuss the use of BIND 9, which ships with Fedora. BIND 9 was rewritten from scratch in an attempt to make the code more robust and leave behind the problems inherent in the old code. It is compliant with new DNS standards and represents a substantial improvement in features, performance, and security.NOTE
If you are upgrading from BIND 8 to BIND 9, make sure to read the file /usr/share/doc/bind-9.5.0/misc/migration for any issues regarding configuration files (which will cause BIND not to run) and use of existing shell scripts. An HTML version of the BIND 9 manual is the Bv9ARM.html file under the /usr/share/doc/bind-9.5.0/arm directory.
After you install the RPMs, the following directories are of special interest because they contain the file used by BIND and contain the information shown in the listing:NOTE
You can find build instructions in the Read Me file under the /usr/share/doc/bind-9.5.0 directory, too.
The next several numeric fields specify various characteristics of this zone. These values must be correctly configured, and to do so, you must understand each field. As shown in the comments (note that zone file comments are not the in the same syntax as named.conf comments), the fields are serial number, refresh interval, retry time, expire period, and minimum TTL.TIP
It is important to ensure that mail to the contact email address specified in the SOA field is frequently read because it is used to report DNS setup problems and other potentially useful information.
TXT Records and SPF
One record not already mentioned is the TXT record. This record is usually used for documentation purposes in DNS, but a recent proposal uses the TXT record to help in the fight against email address forgery, spam, and phishing attacks. One problem with email and SMTP is that when email is being delivered, the sender can claim that the email is coming from trusted.bank.com, when really it is coming from smalltime.crook.com. When the recipient of the email gets the email, it looks like valid instructions from trusted.bank.com; but if the receiver trusts the email and follows its instructions, his bank accounts can become vulnerable. These situations can be controlled by using SPF (Sender Policy Framework).
Domains can publish the valid IP address of their email servers in specially formatted TXT records. A TXT record could look like this:
trusted.bank.com. IN TXT "v=spf1 ip4:37.21.50.80 -all"
This record specifies that only one IP address is allowed to send mail for trusted.bank.com.
Receiving email servers can then do one extra check with incoming email. When an email arrives, they know the IP address that the email is coming from. They also know that the sender claims to be coming from trusted.bank.com, for example. The receiving email server can look up the DNS TXT record for trusted.bank.com, extract the allowed IP addresses, and compare them to the IP address that the email really is coming from. If they match, it is an extremely good indication that the email really is coming from trusted.bank.com. If they do not match, it is a very good indication that the email is bogus and should be deleted or investigated further.
The SPF system does rely on cooperation between senders and receivers. Senders must publish their TXT records in DNS, and receivers must check the records with incoming email. If you want more details on SPF, visit the home page at http://spf.pobox.com/.
NOTE
Retaining and frequently examining your logs is especially important because syntax errors often cause BIND to reject a zone and not answer queries for it, causing your server to become lame (meaning that it is not authoritative for the zone for which it is supposed to be).
CAUTION
Be aware that in the real world you might have to wait for months for your ISP to get the reverse delegation right, and your reverse zone remains broken until then.
NOTE
RFC 1912, "Common DNS Operational and Configuration Errors," discusses several of the most common DNS problems at length. It is available at http://www.intac.com/~cdp/cptd-faq/.
After you type the root password and press the Enter key, the client launches. You then see its main window, as shown in Figure 23.2.NOTE
Using system-config-bind and then saving any changes overwrites existing settings! If you prefer to manually edit your named configuration files, do not use system-config-bind. Always make a backup of the configuration files in any event — you'll be glad you did.
TIP
One of your strongest defenses against DNS security risks is to keep abreast of developments in security circles and act on them promptly. The BugTraq mailing list, hosted at http://www.securityfocus.com/, and the SANS Institute, at http://www.sans.org/, are good places to start.
For a chroot environment to work properly, you have to set up a directory that contains everything BIND needs to run. It is recommended that you start with a working configuration of BIND, create a directory — say /usr/local/bind — and copy over the files it needs into subdirectories under that one. For instance, you have to copy the binaries, some system libraries, the configuration files, and so on. Consult the BIND documentation for details about exactly which files you need.CAUTION
Programs that use chroot but do not take any other precautions have been shown to be unsecure. BIND does take such additional precautions. See the chroot-BIND HOWTO at http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Chroot-BIND-HOWTO.html.
TIP
The Security Level Configuration Tool (system-config-securitylevel) has been updated to make implementation of the firewall simpler. The new on/off choice (rather than levels as used before) allows you to employ a firewall without requiring any special configuration for your DNS server.
Related Fedora and Linux Commands
You can use the following commands to manage DNS in Fedora:
► dig — The domain information groper command, used to query remote DNS servers
► host — A domain nameserver query utility
► named — A domain nameserver included with Fedora
► system-config-bind — A GUI tool to configure DNS information
► nsupdate — A Dynamic DNS update utility
► rndc — The nameserver control utility included with BIND
This chapter looks at a relatively basic installation of an LDAP server, including how to host a companywide directory service that contains the names and email addresses of employees. LDAP is a client/server system, meaning that an LDAP server hosts the data and an LDAP client queries it. Fedora comes with OpenLDAP as its LDAP server, along with several LDAP-enabled email clients, including Evolution and Mozilla Thunderbird. This chapter covers all three of these applications.TIP
Most people find the concept of LDAP easier to grasp when they think of it as a highly specialized form of database server. Behind the scenes, Fedora uses a database for storing all its LDAP information; however, LDAP does not offer anything as straightforward as SQL for data manipulation!
OpenLDAP uses Sleepycat Software's Berkeley DB (BDB), and sticking with that default is highly recommended. That said, there are alternatives if you have specific needs.
TIP
Checking Enable LDAP Support does not actually change the way in which your users log in. Behind the scenes, this forces Fedora to set up the ldap.conf file in /etc/openldap so that LDAP searches that do not specify a base search start point are directed to your DC.
The jpegPhoto attribute for the first entity has very particular syntax. Immediately after the colon you use an opening angle bracket (<), followed by a space and then the location of the person's picture. Because the picture is local, it is prefixed with file://. It is in /home/paul/paulhudson.jpg, so the whole URL is file:///home/paul/paulhudson.jpg.TIP
Having multiple key/value pairs, like multiple CNs, is one of the defining features of LDAP. In today's interconnected world, few people can be defined in a single set of attributes because they have home phone numbers, work phone numbers, cell phone numbers, plus several email addresses, and potentially even a selection of offices where they hot desk. Using multiple CNs and other attributes allows you to properly record these complex scenarios.
TIP
OpenLDAP needs specific permissions for its files. The /var/lib/ldap directory should be owned by user ldap and group ldap, with permissions 600. If you experience problems, try running chmod 600 /var/lib/ldap.
You can use Perl at your shell's command line to execute one-line Perl programs, but most often the programs (usually ending in .pl) are run as commands. These programs generally work on any computer platform because Perl has been ported to just about every operating system. Perl is available by default when you install Fedora, and you will find its RPM files on the DVD included with this book.NOTE
In Perl, "there is more than one way to do it." This is the unofficial motto of Perl, and it comes up so often that it is usually abbreviated as TIMTOWTDI.
The sample program in the listing is a two-line Perl program. Typing in the program and running it (using Perl or making the program executable) shows how to create your first Perl program, a process duplicated by Linux users around the world every day!Command-Line Error
If you get the message bash: trivial.pl: command not found or bash: ./trivial.pl: Permission denied, it means that you either typed the command line incorrectly or forgot to make trivial.pl executable (with the chmod command):
$ chmod +x trivial.pl
You can force the command to execute in the current directory as follows:
$ ./trivial.pl
Or you can use Perl to run the program like this:
$ perl trivial.pl
The #! line is technically not part of the Perl code at all. The # character indicates that the rest of the screen line is a comment. The comment is a message to the shell, telling it where it should go to find the executable to run this program. The interpreter ignores the comment line.NOTE
#! is often pronounced she-bang, which is short for sharp (the musicians name for the # character), and bang, which is another name for the exclamation point. This notation is also used in shell scripts. Refer to Chapter 33, "Writing and Executing a Shell Script," for more information about writing shell scripts.
TIP
Using the perldoc and man commands is an easy way to get more information about the version of Perl installed on your system. To learn how to use the perldoc command, enter the following:
$ perldoc perldoc
To get introductory information on Perl, you can use either of these commands:
$ perldoc perl
$ man perl
For an overview or table of contents of Perl's documentation, use the perldoc command like this:
$ perldoc perltoc
The documentation is extensive and well organized. Perl includes a number of standard Linux manual pages as brief guides to its capabilities, but perhaps the best way to learn more about Perl is to read its perlfunc document, which lists all the available Perl functions and their usage. You can view this document by using the perldoc script and typing perldoc perlfunc at the command line. You can also find this document online athttp://www.cpan.org/doc/manual/html/pod/perlfunc.html.
Operator | Meaning |
---|---|
== | Is equal to |
< | Less than |
> | Greater than |
<= | Less than or equal to |
>= | Greater than or equal to |
!= | Not equal to |
.. | Range of >= first operand to <= second operand |
<=> | Returns -1 if less than, 0 if equal, and 1 if greater than |
Operator | Meaning |
---|---|
eq | Is equal to |
lt | Less than |
gt | Greater than |
le | Less than or equal to |
ge | Greater than or equal to |
ne | Not equal to |
cmp | Returns -1 if less than, 0 if equal, and 1 if greater than |
=~ | Matched by regular expression |
!~ | Not matched by regular expression |
Operator | Meaning |
---|---|
&& | Logical AND |
|| | Logical OR |
! | Logical NOT |
() | Parentheses; used to group compound statements |
Operator | Purpose |
---|---|
x**y | Raises x to the y power (same as x^y) |
x%y | Calculates the remainder of x/y |
x+y | Adds x to y |
x-y | Subtracts y from x |
x*y | Multiplies x times y |
x/y | Divides x by y |
-y | Negates y (switches the sign of y); also known as the unary minus |
++y | Increments y by 1 and uses value (prefix increment) |
y++ | Uses value of y and then increments by 1 (postfix increment) |
--y | Decrements y by 1 and uses value (prefix decrement) |
y-- | Uses value of y and then decrements by 1 (postfix decrement) |
x=y | Assigns value of y to x. Perl also supports operator-assignment operators (+=, -=, *=, /=, %=, **=, and others) |
Operator | Purpose |
---|---|
~x | Bitwise not (changes 0 bits to 1 and 1 bits to 0) |
x & y | Bitwise and |
x | y | Bitwise or |
x ^ y | Bitwise exclusive or (XOR) |
x << y | Bitwise shift left (shifts x by y bits) |
x >> y | Bitwise shift right (shifts x by y bits) |
x . y | Concatenate y onto x |
a x b | Repeats string a for b number of times |
x , y | Comma operator — evaluates x and then y |
x ? y : z | Conditional expression — if x is true, y is evaluated; otherwise, z is evaluated. |
Expression | Meaning |
---|---|
\\ | The means of including a backslash |
\a | The alert or bell character |
\b | Backspace |
\c | Control character (like holding the Ctrl key down and pressing the C character) |
\e | Escape |
\f | Formfeed |
\n | Newline |
\r | Carriage return |
\t | Tab |
\xNN | Indicates that NN is a hexadecimal number |
\0NNN | Indicates that NNN is an octal (base 8) number |
NOTE
You can restate the preceding example in more natural language like this:
print "Go away!\n" unless $name eq "Rich";
NOTE
foreach is frequently abbreviated as for.
Element | Explanation |
---|---|
$string =~ | Performs this pattern match on the text found in the variable called $string. |
s | Substitutes one text string for another. |
/ | Begins the text to be matched. |
bob|mary | Matches the text bob or mary. You should remember that it is looking for the text mary, not the word mary; that is, it will also match the text mary in the word maryland. |
/ | Ends text to be matched; begins text to replace it. |
fred | Replaces anything that was matched with the text fred. |
/ | Ends replace text. |
g | Does this substitution globally; that is, replaces the match text wherever in the string you match it (and any number of times). |
i | Make the search text case insensitive. It matches bob, Bob, or bOB. |
; | Indicates the end of the line of code |
You can also use the Shell module to access the shell. Shell is one of the standard modules that comes with Perl; it allows creation and use of a shell-like command line. Look at the following code for an example:NOTE
The `` notation uses the backtick found above the Tab key (on most keyboards), not the single quotation mark.
You will use these commands and tools when using Perl with Linux:Related Fedora and Linux Commands
NOTE
PHP's installation packages are under the Web Server category in Add/Remove Applications. The basic package is just called php, but you might also want to add extensions such as php_ldap, php_mysql, or php_pgsql. Choose only the extensions you plan to use; otherwise, you will waste system resources.
Type | Stores |
---|---|
integer | Whole numbers; for example, 1, 9, or 324809873 |
float | Fractional numbers; for example, 1.1, 9.09, or 3.141592654 |
string | Characters; for example, "a", "sfdgh", or "Fedora Unleashed" |
boolean | True or false |
array | Several variables of any type |
object | An instance of a class |
resource | Any external data |
NOTE
Contrary to popular belief, having comments in your PHP script has almost no effect on the speed at which the script executes. What little speed difference exists is wholly removed if you use a code cache.
Operator | What It Does |
---|---|
= | Assigns the right operand to the left operand. |
== | Returns true if the left operand is equal to the right operand. |
!= | Returns true if the left operand is not equal to the right operand. |
=== | Returns true if the left operand is identical to the right operand. This is not the same as ==. |
!== | Returns true if the left operand is not identical to the right operand. This is not the same as !=. |
< | Returns true if the left operand is smaller than the right operand. |
> | Returns true if the left operand is greater than the right operand. |
<= | Returns true if the left operand is equal to or smaller than the right operand. |
&& | Returns true if both the left operand and the right operand are true. |
|| | Returns true if either the left operand or the right operand is true. |
++ | Increments the operand by one. |
-- | Decrements the operand by one. |
+= | Increments the left operand by the right operand. |
-= | Decrements the left operand by the right operand. |
. | Concatenates the left operand and the right operand (joins them). |
% | Divides the left operand by the right operand and returns the remainder. |
| | Performs a bitwise OR operation. It returns a number with bits that are set in either the left operand or the right operand. |
& | Performs a bitwise AND operation. It returns a number with bits that are set both in the left operand and the right operand. |
NOTE
It is common practice to put function calls in conditional statements rather than direct comparisons. For example:
if (do_something()) {
If the do_something() function returns true (or something equivalent to true, such as a nonzero number), the conditional statement evaluates to true.
C++ is an object-oriented extension to C. Because C++ is a superset of C, C++ compilers compile C programs correctly, and it is possible to write non-object-oriented code in C++. The reverse is not true: C compilers cannot compile C++ code.NOTE
The Linux kernel is mostly written in C, which is why Linux works with so many different CPUs. To learn more about building the Linux kernel from source, see Chapter 36, "Kernel and Module Management."
Using the makefile from the preceding example, you can build a program like this:NOTE
The indented lines in the previous example are indented with tabs, not spaces. This is very important to remember! It is difficult for a person to see the difference, but make can tell. If make reports confusing errors when you first start building programs under Linux, you should check your project's makefile for the use of tabs and other proper formatting.
NOTE
Most C programs compile with a C++ compiler if you follow strict ANSI rules. For example, you can compile the standard hello.c program (everyone's first program) with the GNU C++ compiler. Typically, you name the file something like hello.cc, hello.c, hello.c++, or hello.cxx. The GNU C++ compiler accepts any of these names.
Related Fedora and Linux Commands
You will use many of these commands when programming in C and C++ for Linux:
► ar — The GNU archive development tool
► as — The GNU assembler
► autoconf — The GNU configuration script generator
► cervisia — A KDE client that provides a graphical interface to a CVS project
► cvs — An older project revision control system, now replaced by Subversion
► designer — Trolltech's graphical prototyping tool for use with Qt libraries and X
► gcc — The GNU C/C++ compiler system
► gdb — The GNU interactive debugger
► glade-3 — The GNOME graphical development environment for building GTK+ clients
► gprof — The GNU program profiler
► kdevelop — The KDE C/C++ graphical development environment for building KDE, GNOME, or terminal clients
► make — A GNU project management command
► patch — Larry Wall's source patching utility
► pmake — A BSD project management command
► splint — The C source file checker
► svn — The Subversion version control system
When MonoDevelop has loaded, go to the File menu and choose New Project. From the left of the window that appears, choose C#, then Console Project. Give it a name and choose a location to save it — all being well, you should see something similar to Figure 29.1. When you're ready, click New to have MonoDevelop generate your project for you.TIP
You don't have to use MonoDevelop to write your code, but it helps — syntax highlighting, code completion, and drag-and-drop GUI designers are just a few of its features.
Although you should never ignore the internal threat, you should arguably be more concerned with the outside world. The big bad Internet is a security vortex. Machines connected directly to the outside world can be attacked by people across the world, and invariably are, even only a few minutes after having been connected.Hacker Versus Cracker
In earlier days, there was a distinction made between the words hacker and cracker. A hacker was someone who used technology to innovate in new or unusual ways, whereas a cracker was someone who used technology to attack another's computers and cause harm.
This distinction was lost on the general public, so the term hacker has now come to mean the same as cracker when talking about security.
The better the physical security is around your network, the more secure it will be (this applies to wired networks as well). Keep wireless transmitters (routers, switches, and so on) as close to the center of your building as possible. Note or monitor the range of transmitted signals to determine whether your network is open to mobile network sniffing — now a geek sport known as war driving. (Linux software is available at http://sourceforge.net/project/showfiles.php?group_id=57253.) An occasional walk around your building not only gives you a break from work, but can also give you a chance to notice any people or equipment that should not be in the area.TIP
Always use OpenSSH-related tools, such as ssh or sftp, to conduct business on your wireless LAN. Passwords are not transmitted as plain text, and your sessions are encrypted. Refer to Chapter 15, "Remote Access with SSH," to see how to connect to remote systems with ssh.
Do not forget to use the right tool for the right job. Although a network bridge can be used to connect your network to the Internet, doing so would not be a good option. Bridges have almost become obsolete because they forward any packet that comes their way, which is not good when a bridge is connected to the Internet. A router enables you to filter which packets are relayed.NOTE
Browse to http://www.redhat.com/docs/manuals/ to read about how to detect unauthorized network intrusions or packet browsing (known as network sniffing). You can use the information to help protect your system. Scroll down the page and click the Security Guide link.
Related Fedora and Linux Commands
These commands are used to manage security in your Fedora system:
► Ethereal — GNOME graphical network scanner
► gnome-lokkit — Fedora's basic graphical firewalling tool for X
► lokkit — Fedora's basic graphical firewalling tool
► ssh — The OpenSSH remote login client and preferred replacement for telnet
► system-config-securitylevel — Fedora's graphical firewall configuration utility
Systemwide tweaks to hdparm are formally handled through the /etc/sysconfig/harddisks files, but this file's use is poorly documented and, therefore, of little use.TIP
You can use the hdparm command to produce a disk transfer speed result with the following:
# hdparm -tT device
Be aware, however, that although the resulting numbers appear quantitative, they are subject to several technical qualifications beyond the scope of what is discussed and explained in this chapter. Simply put, do not accept values generated by hdparm as absolute numbers, but as only a relative measure of performance.
TIP
You might find that your system turns off DMA for any CD-RW drives detected via a shell script command in rc.sysinit. This might not be appropriate for your hardware, so you can turn it back on simply by adding the line options ide-cd dma=1 to /etc/modules.conf.
Synchronizing the File System with sync
Because Linux uses buffers when writing to devices, the write does not occur until the buffer is full, until the kernel tells it to, or if you tell it to by using the sync command. Traditionally, the command is given twice, as in the following:
# sync ; sync
It is really overkill to do it twice. Still, it can be helpful prior to the unmounting of certain types of media with slow write speeds (such as some USB hard drives or PCMCIA storage media), but only because it delays the user from attempting to remove the media too soon, not because two syncs are better than one.
If you find that a particular setting is useful, you can enter it into the /etc/sysctl.conf file. The format is as follows, using the earlier example:NOTE
Fedora provides a graphical interface to the sysctl command in system-config-proc. It's still a beta-quality application, and it must be launched from the command line. The interface itself is unremarkable, and it does not provide a means to manipulate all the possible values, but it does offer useful help for the kernel variables it addresses.
TIP
The kernel does a good job of balancing performance for graphical systems, so there's not a great deal you can do to tweak your desktop to run faster.
Both GNOME and KDE are "heavyweight" desktop systems: They are all-inclusive, all-singing, and all-dancing environments that do far more than browse your file system. The drawback to this is that their size makes them run slowly on older systems. On the flip side, Fedora also comes with the Xfce desktop, which is a great deal slimmer and faster than the other two. If you find GNOME and KDE are struggling just to open a file browser, Xfce is for you.
Alternatively, if you simply cannot live without GNOME or KDE, take a look in the /usr/share/autostart directory, where you will see a list of files that are started when your graphical system boots. If you do not need any of them, just move them out of there and into somewhere safe in case you ever need them again.
The first target of your tuning should be the httpd.conf file in /etc/httpd/conf, as well as the other files in /etc/httpd/conf.d. The more modules you have loaded, the more load Apache is placing on your server — take a look through the LoadModule list and comment out (start the line with a #) the ones you do not want. Some of these modules can be uninstalled entirely through the Add or Remove Packages dialog.NOTE
Slashdot.org is a popular geek news website that spawned the Slashdot Effect — the result of thousands of geeks descending on an unsuspecting website simultaneously. Our $1,000 Dell server had dual 2.8GHz Xeons with 1GB of RAM and SCSI hard disks — if you have more RAM, faster chips, and a high-end network card, you can kick sand in Slashdot's face.
TIP
Some people, when questioned about optimizing Apache, recommend you tweak the HARD_SERVER_LIMIT in the Apache source code and recompile. Although we agree that compiling your own Apache source code is a great way to get a measurable speed boost if you know what you are doing, you should need to change this directive only if you are hosting a huge site.
The default value, 256, is enough to handle the Slashdot Effect — and if you can handle that, you can handle most things.
One evening, Master Foo and Nubi attended a gathering of programmers who had met to learn from each other. One of the programmers asked Nubi to what school he and his master belonged. Upon being told they were followers of the Great Way of UNIX, the programmer grew scornful.Whimsical as the story is, it illustrates that there are some things that the GUI just does not do well. Enter the command line: It is a powerful and flexible operating environment on Linux, and — if you practice — can actually be quite fun, too!
"The command-line tools of UNIX are crude and back ward," he scoffed. "Modern, properly designed operating systems do everything through a graphical user inter face."
Master Foo said nothing, but pointed at the moon. A nearby dog began to bark at the master's hand.
"I don't understand you!" said the programmer.
Master Foo remained silent, and pointed at an image of the Buddha. Then he pointed at a window.
"What are you trying to tell me?" asked the programmer.
Master Foo pointed at the programmer's head. Then he pointed at a rock.
"Why can't you make yourself clear?" demanded the programmer.
Master Foo frowned thoughtfully, tapped the programmer twice on the nose, and dropped him in a nearby trash can.
As the programmer was attempting to extricate himself from the garbage, the dog wandered over and piddled on him.
At that moment, the programmer achieved enlightenment.
TIP
Running du in a directory where several files are hard-linked to the same inode counts the size of the file only once. If you want to count each hard link separately for some reason, use the -l parameter (lowercase L).
Both types of link are created with the ln command. By default, the ln command creates hard links, but you can create symlinks by passing it the -s parameter. The syntax is ln [-s] <something> <somewhere>, for example:TIP
The shred command overwrites a file's contents with random data, allowing for safe deletion. Because this directly affects a file's contents, rather than just a filename, this means that all filenames hard linked to an inode are affected.
When you are learning to write and execute your first shell scripts, start with scripts for simple but useful tasks. Begin with short examples, and then expand the scripts as you build on your experience and knowledge. Make liberal use of comments (lines preceded with a pound # sign) to document each section of your script. Include an author statement and overview of the script as additional help, along with a creation date or version number. Use a text editor such as vi to write shell scripts because it does not automatically wrap lines of text. Line wrapping can break script syntax and cause problems. If you use the nano editor, include its -w flag to disable line wrap.NOTE
Hundreds of commands included with Fedora are actually shell scripts, and many other good shell script examples are available over the Internet — a quick search yields numerous links to online tutorials and scripting guides from fellow Linux users and developers. For example, the startx command, used to start an X Window session from the text console, is a shell script used every day by most users. To learn more about shell scripting with bash, see the Advanced Bash-Scripting Guide, listed in the "Reference" section at the end of this chapter. You will also find Sams Teach Yourself Shell Programming in 24 Hours a helpful guide to learning more about using the shell to build your own commands.
After you execute the command myenv, you should be able to use ldir from the command line to get a list of files under the current directory and ll to get a list of files with attributes displayed. However, the best way to use the new commands in myenv is to put them into your shell's login or profile file. For Fedora, and nearly all Linux users, the default shell is bash, so you can make these commands available for everyone on your system by putting them in the /etc/bashrc file. Systemwide aliases for tcsh are contained in files with the extension .csh under the /etc/profile.d directory. The shell can use these command aliases, too.CAUTION
Never put . in your $PATH to execute files or a command in the current directory — this presents a serious security risk, especially for the root operator, and even more so if . is first in your $PATH search order. Trojan scripts placed by crackers in directories such as /tmp can be used for malicious purposes, and are executed immediately if the current working directory is part of your $PATH.
You might also find different or new environment variables available to your scripts by using different shells. For example, if you launch csh from the bash command line, you will find several new variables or variables with slightly different definitions, such as the following:The Shebang Line
The shebang line is a magic number, as defined in /usr/share/magic — a text database of magic numbers for the Linux file command. Magic numbers are used by many different Linux commands to quickly identify a type of file, and the database format is documented in the section five man page named magic (read by using man 5 magic). For example, magic numbers can be used by the Linux file command to display the identity of a script (no matter what filename is used) as a shell script if a specific shell or other interpreter is used, such as awk or Perl.
Command | Environment |
---|---|
lcount=0 | bash |
set lcount=0 | tcsh |
To store a string in a variable, you can use the following:NOTE
Under bash, you must ensure that the equal sign (=) does not have spaces before and after it.
Command | Environment |
---|---|
myname=Andrew | bash |
set myname=Andrew | tcsh |
Command | Environment |
---|---|
myname="Andrew Hudson" | bash |
set myname="Andrew Hudson" | tcsh |
Command | Environment |
---|---|
lcount=$var | bash |
set lcount=$var | tcsh |
You can test the script by running it manually and feeding it a keyword and a pathname to the system log, /var/log/messages, like this:NOTE
By default, Fedora uses the logwatch log monitoring command (actually a Perl script) in your system's /etc/cron.daily directory to generate various reports each day at 0402 (4:02 a.m.). Configure logwatch by editing the file /etc/log.d/logwatch.conf. Other system monitoring tools are included, such as tripwire. You can control system logging by editing /etc/syslog.conf.
Character | Explanation |
---|---|
$ | Indicates the beginning of a shell variable name |
| | Pipes standard output to next command |
# | Starts a comment |
& | Executes a process in the background |
? | Matches one character |
* | Matches one or more characters |
> | Output redirection operator |
< | Input redirection operator |
` | Command substitution (the backquote or backtick — the key above the Tab key on most keyboards) |
>> | Output redirection operator (to append to a file) |
<< | Wait until following end-of-input string (HERE operator) |
[ ] | Range of characters |
[a-z] | All characters a through z |
[a,z] or [az] | Characters a or z |
Space | Delimiter between two words |
Command | Environment |
---|---|
x=abc def | bash |
set x=abc def | tcsh |
Command | Environment |
---|---|
x="abc def" | bash |
set x="abc def" | tcsh |
Command | Environment |
---|---|
var=$test | bash |
set var=$test | tcsh |
Command | Environment |
---|---|
var=\$test | bash |
set var = \$test | tcsh |
Command | Environment |
---|---|
var=`wc -l test.txt` | bash |
set var = `wc -l test.txt` | tcsh |
In bash, the following format is used for the while flow-control construct:Endless Loops Have Their Place in Shell Programs
Endless loops can sometimes be useful. For example, you can easily construct a simple command that constantly monitors the 802.11b link quality of a network interface by using a few lines of script:
#!/bin/sh
while :
do
/sbin/iwconfig eth0 | grep Link | tr '\n' '\r'
done
The script outputs the search, and then the tr command formats the output. The result is a simple animation of a constantly updated single line of information:
Link Quality:92/92 Signal level:-11 dBm Noise level:-102 dBm
This technique can also be used to create a graphical monitoring client for X that outputs traffic information and activity about a network interface:
#!/bin/sh
xterm -geometry 75x2 -e \
bash -c \
"while :; do \
/sbin/ifconfig eth0 | \
grep 'TX bytes' | tr '\n' '\r' ; \
done"
The simple example uses a bash command-line script (enabled by -c) to execute a command line repeatedly. The command line pipes the output of the ifconfig command through grep, which searches ifconfig's output and then pipes a line containing the string "TX bytes" to the tr command. The tr command then removes the carriage return at the end of the line to display the information inside an /xterm X11 terminal window, automatically sized by the -geometry option:
RX bytes:4117594780 (3926.8 Mb) TX bytes:452230967 (431.2 Mb)
Endless loops can be so useful that Linux includes a command that repeatedly executes a given command line. For example, you can get a quick report about a system's hardware health by using the sensors command. But rather than use a shell script to loop the output endlessly, you can use the watch command to repeat the information and provide simple animation:
$ watch "sensors -f | cut -c 1-20"
The RPM database installed on your computer keeps track of which versions of which packages are installed. RPM uses your system's /var/lib/rpm directory to store files (actually databases) containing information about the software installed on your system. You can use the ls command to view these files. (You might see file sizes different from those shown here, depending on the amount of software you have installed.)What Is RPM?
RPM has a long history and is closely associated with Red Hat, the sponsors of Fedora. RPM itself can link itself back to early Linux package management software — named RPP PMS, and PM — that were written in Perl. RPM came onto the scene in Red Hat Linux 2.0, released late 1995, and was then rewritten in C for the Red Hat Linux 3.0.3 (Picasso) release in 1996. Since then, the rpm command has been the prime feature of Red Hat's unique software management system, which is based on the concept of pristine sources, or the capability to use a single, initial archive of a program's source code to build packages for different systems and to track versions.
In addition to improving the package management of early software management scripts, RPM version 4.1 introduced software features designed to ease the task of building software for different platforms from a single set of source-code files. Changes can be tracked and kept outside a developer's initial source code, and multiple packages can be built from scratch and installed at the same time. Simultaneously, RPM also verifies installation dependencies. Additional features, such as a checksum and GNU Privacy Guard (GPG) signatures, enable binary software pack ages to be safely distributed without the fear of virus infection or the inclusion of Trojan code. Red Hat has committed to further active development of RPM.
Option | Used To |
---|---|
rpm-i | Install a package Useful options to -i: |
--excludedocs: Does not install documentation to save space | |
--replacepkgs: Replaces the package with a new copy of itself | |
--force: The "big hammer" — Ignores all warnings and installs anyway | |
--noscripts: Does not execute any pre- or post-install scripts | |
--nodeps: Ignores any dependencies | |
--root path: Sets an alternative root to path | |
rpm -e | Erase (deletes) a package. Useful option to -e: |
--nodeps: Ignores any dependencies | |
rpm -U | Upgrade a package, removing the older one but keeping modified files, such as configurations. Useful options to -U: |
--oldpackage: Permits downgrading to an older version | |
Other options are the same as with rpm -i | |
rpm -q | Query about package information. Useful options to -q: |
-p file: Displays all information about the package file | |
-f file: Asks what package owns the file file? | |
--whatprovides x: Determines what packages provide x | |
--whatrequires x: Determines what packages require x | |
-i: Summarizes the package information | |
-l: Lists the files in package | |
--scripts: Displays the contents of any install, uninstall, or verifies scripts | |
--provides: Displays the capabilities package provides | |
--requires: Displays the capabilities package requires | |
rpm -V | Verify packages against the RPM database .Useful options to -V: |
-a: Verifies all installed packages | |
rpm -K | Use GPG to verify a downloaded package Useful options to -K: |
--nosignature: If you lack public GPG encryption keys, do not have GPG installed, or are legally prohibited from using GPG, this still verifies the package using size and MD5 checksums. |
RPM Is for Programmers, Too!
Remember that RPM was created not only to provide an easy-to-use administrative tool, but also as a developer's tool for use in multiplatform source-code package management. Programmers using rpm for development and distribution use its rpmbuild command, along with a myriad of additional command-line flags. RPM can be used to build binaries, execute programs, test installations, verify and sign packages, build source packages, track versions, and target builds for specific architectures. You can find details at the RPM home page (http://www.rpm.org).
As you can see from the following program output, you can get additional information about a package by adding additional verification options (such as two more v's) to the -V option. To get more information about an installed package, use one or more forms of the rpm query options. For example, to display concise information about an installed package, use the -q option, along with the i option and the installed package name, like this. (Note that your version will differ from that shown here.)NOTE
If everything is correct with your software installation, your system displays no response to rpm -V after you run the command; only problems are displayed.
NOTE
Another essential feature of the rpm command is its --rebuilddb option. If your system's RPM database becomes corrupted, this is your first (and perhaps only) option for restoring software management services. We hope that you never have to use this option; help ensure that by always backing up your data!
To get going with yum, you will need to open a terminal. Check that yum is installed and working by simply typing the following:yum
yum is controlled entirely from the command line, so you have to memorize some useful switches to get the most from it. But before you go into yum itself, it is worth while understanding what goes on behind the scenes. How does yum actually work?
It is easiest to think of yum as a software layer that utilizes the rpm command. When you issue commands to yum, it automatically accesses various repositories and down loads the rpm headers that you requested and then queries them with the rpm command. The advantage to this is that all the processing takes place locally, without the need to download the entire RPM itself. Typically, the RPM header makes up a very small portion of the file, which makes it easy to handle and quick to download. yum builds and maintains a local cache of header files, attributed to the supplying repository, and queries this when you use yum. Each time yum is invoked, it checks the repositories for any updates. If any are found, it adds new headers to its cache, thereby making it as up-to-date as possible when you need to use it. Because yum uses rpm, there should be no dependency problems, making it a fast and easy way to install and update software.
yum is primarily controlled by its configuration file, yum.conf, and by the contents of the yum.repos.d directory, both of which can be found in /etc. By default, yum uses the Fedora repositories for updates, but you can easily add more of your own if you want to install other software that is not available from the default repositories. yum is incredibly easy to use, requiring a single command with a switch to update all the software in Fedora.
About yum
yum is not developed solely by Red Hat. Instead, Duke University has the honor of being the creator and maintainer of yum and its related technology. In particular, Seth Vidal has spent a lot of time and effort ensuring that yum improves in both speed and functionality. Subscribe to the yum mailing list at https://lists.dulug.duke.edu/mailman/listinfo/yum for the latest information and updates on yum. Seth has now moved across to Red Hat and spends most of his time working on yum!
Finally, if you want to remove both the packages and the headers in one quick step, you should use this command:NOTE
If you decide to remove the header files, yum has to re-download them the next time that you decide to update your system. This can take a little bit of time, but should not be a problem if you have a fast broadband connection.
Opening a repository file shows you some details about the repository itself, including the path to it (either via HTTP, FTP, or local access), any lists of mirrors for that repository, whether that repository is enabled, and whether GPG checking is enabled.CAUTION
Unless you really know what you are doing, avoid the more unstable repositories of fedora-updates-testing and fedora-development. These repositories contain bleeding-edge packages that can break your system. You have been warned!
CAUTION
Notice that we say the use of GPG keys can make packages safer to use. This is certainly true, but be aware that sometimes packages can conflict with each other. Be careful about which repositories you use because some are incompatible with others. When selecting a repository, always read any FAQs for warnings of incompatibilities.
How big are these blocks? The default size is 1,024 bytes, but the size can be made smaller or larger when the file system is first created. The optimum size is determined by the application of the particular machine. If you typically use very large files, a larger block size can speed up disk I/O operations at the expense of slower I/O for smaller files; the reverse is also true. For an individual system, block size might require monitoring over time and benchmarking before an optimal value is determined. For most users, the defaults have been found satisfactory.Inodes and File Attributes
The information that constitutes a file in the ext2/ext3 file system begins with the inode. The inode contains the following description of the file: the file type, its access rights, its owners, several different time stamps, the file size, and pointers to data blocks that hold the file information. When you want to access a file, the kernel uses those pointers to calculate where the data resides physically on the disk.
File attributes are also stored in the inode. The chattr command enables the root operator to manipulate some special attributes of files on an ext2/3 file system. One of the most interesting uses of the chattr command is to make a file immutable, meaning that it cannot be deleted, renamed, written to, or modified by anyone, even root (at least until the immutable attribute is unset). To make a file immutable (the word means unalterable; not capable of change):
# chattr +i filename
and to change it back:
# chattr -i filename
Another interesting flag is the s flag, which tells the system to zero out all the blocks used for that file when the file is deleted. To observe the existing attributes of a file, use:
# lsattr filename
The chattr utility is part of the e2fsprogs package.
A file's attributes include its access permissions. The traditional Unix system of permissions is controlled with chmod. Posix Access Control Lists extend this functionality.
ACL supports permissions for users and groups beyond the traditional owner/group/world scheme. They enable finer-grained control of permissions for files.
To learn more about Access Control Lists, visit the Posix ACLs for Linux website: http://acl.bestbits.at/.
NOTE
Other modules and support are likely available if you care to search the Internet for them; try searching on the keyword file systems on http://freshmeat.net/ and http://www.google.com/linux/. As is always the case with open-source operating systems, any skilled and enterprising soul can write his own file system modules.
Some common network file system types are:NOTE
Mounting is the Unix method of attaching a file system (also referred to as a volume) to the file system tree at a mount point. Using the mount command is covered later in this chapter.
The ext3 file system can accommodate files as large as 2TB, directories as large as 2TB, and a maximum filename length of 255 characters. (With special kernel patches, this limit can be increased to 1,024 characters if the standard length is insufficient for your use.) The ext3 file system can allocate and use empty space in a very efficient manner.NOTE
The downside to using ext3 seems to be performance related. A recent benchmarking evaluation (see http://fsbench.netnation.com/) of all Linux file systems placed ext3 at the bottom for general performance. What the study really demonstrates is that you must match the file system to the application for best all-around performance.
Every file system varies in structure, depending on its efficiency, security, and even proprietary designs to limit cross-compatibility deliberately. The ext3 file systems were designed to follow Unix design concepts, particularly "everything is a file."NOTE
A defragmentation program for the ext2 file system does exist, but it is infrequently used, is not typically included with standard Linux distributions such as Fedora, and is not recommended for general use. The ext2/3 file system assigns blocks of space for files based on their parent directories; this spaces files out all over the physical disk, leaving room to keep files contiguous and reduce fragmentation. However, a file system full of files at 90% of its capacity can become badly fragmented.
The file system state is tracked in the ext3 file systems. A special field in the superblock tells the kernel that, after the file system is mounted read/write, it is marked as not clean; when it is properly unmounted, it is marked as clean. If a file system is not unmounted properly, it could contain corrupt data because all the file data might not have been written to it. (This is what the journaling file systems such as ext3 strive to eliminate.) When the system is booted, this flag is checked and if it is not clean, the program fsck is run. Internally, fsck is actually a wrapper program that runs the appropriate version of fsck for the file system in use: fsck.minix, fsck.ext2, fsck.ext3, fsck.reiserfs, fsck.msdos, or fsck.vfat. If the kernel detects an inconsistency in the superblock field, the file system is marked erroneous, and the file system check is forced even if other indicators suggest that fsck does not need to be run.TIP
If you are logged on as a regular user and su to root using su, you do not inherit root's environment and path, meaning that the preceding command does not work unless you use the full path: /usr/sbin/fsck.
Either type the full path each time, or become root with su -, which causes you to inherit root's environment and path; you have less to type.
NOTE
Namesys, the company behind reiserfs, has struggled since its founder (Hans Reiser) was arrested as part of the police investigation into the murder of his wife. Few distros now recommend using reiserfs, so we would recommend avoiding it for the foreseeable future.
NOTE
The Microsoft version of fdisk creates both a partition table and the bootloader. In Linux, fdisk creates only the partition table. The bootloader is created later by LILO, GRUB, or another bootloader; no bootloader is necessary to create a file system and store data on a disk, just a partition table.
In fact, IDE disks physically installed as something other than /dev/hda (such as /dev/hdc, the secondary master drive) do not have a bootloader written to them; the space where the bootloader code normally resides is likely to be blank. For SCSI disks, the drive designated in the BIOS as the bootable drive has the bootloader written to it.
Now that you are running fdisk as root, you can create a partition table. We will assume that you have installed a brand-new drive as /dev/hdb (the Primary Slave IDE device) and want to partition the entire drive as a single partition. Launch fdisk with:TIP
The fdisk command is dangerous to explore only if you write the changes to the partition table. Because you are specifically asked whether you want to do this, poke around to satisfy your curiosity and avoid pressing the w key when you're done; just use q to quit. Armed with this knowledge, do not feel too shy if you're curious about the partition table. But if you really do not want to take a chance on breaking anything, play it safe and use the -l (that's the letter L, not the numeral 1) as in:
# fdisk -l /dev/had
fdisk happily prints the contents of the partition table to the screen (often referred to as stdout, or standard output) and exits without placing you in the edit mode.
It is always a good idea to keep a hard copy of your edited partition table. You can redirect the output of fdisk -l to a file:
# fdisk -l device > mypartitiontable.txt
or send it to the printer with:
# fdisk -l device | kprinter
In the first example, a redirector symbol (>) is used to redirect the listing from stdout to a file. In the second example, we used a pipe (|) to send the output directly to the printer (assuming that you have one connected).
To create the file system structure, you need to do what is sometimes referred to as a high-level format. For FAT file systems, this is accomplished by the format command. In Linux, you use the mke2fs -j command to create an ext3 file system.NOTE
If you are preparing to create a file system on any device other than a floppy disk, examine it with fdisk or another utility of your choice and modify the partition table accordingly (following the instructions you saw in the preceding sections of this chapter).
NOTE
If you are creating a Reiser file system, use the mkreiserfs command. To create a DOS file system, use the mkdosfs command. Other commands for other file systems include:
► mkfs.ext2 — The ext2 file system
► mkfs.msdos — The MS-DOS file system
► mkfs.vfat — The FAT32 file system
To select the ext3 journaling mode, you must add the appropriate entry in /etc/fstab.NOTE
The latter two options in the arguments list are mutually exclusive.
CAUTION
Do not use umount -a to unmount everything that the system does not require to run (or is not currently using). Unmounting everything is a particularly bad idea on a multiuser, networked system because your users are certain to lose access to some or all of their files. So, as any good sysadmin will tell you, do not do that.
As mentioned earlier, you record mounting preferences in /etc/fstab during installation. You need to modify /etc/fstab only if you make changes to your mounts or desire to change the default settings to address the specific needs of your system.NOTE
Device labels can be very useful. You can use the label in /etc/fstab, and if you have many devices, their labels might be easier for you to remember and track than would be their device names. You can also shuffle around partitions without editing fstab, just by changing their labels. The e2label command is easier to remember than the analogous tune2fs command.
The command e2label can display or change a device's label. (You also can change a device label with tune2fs -L.) For example, to change the label of /dev/hda4 to archives, use:
# e2label /dev/hda4 archives
TIP
You can use the previously explained technique as a placeholder or warning for any temporarily mounted file system so that you do not mistakenly think that the file system is mounted when it is not.
Now you can run fsck on the partition. When done,NOTE
Remounting does not work if a normal user is logged in because /home is busy (in use). You might need to switch to runlevel 1 (init 1), which is single-user mode, to remount /home.
Relevant Fedora and Linux Commands
You use these commands when managing file systems in Fedora:
► df — Shows free disk space
► du — Displays disk usage
► dump — An ext2 file system backup utility
► dumpe2fs — Shows information about an ext2 file system
► e2fsadm — Administers an LVM/ext2 file system
► e2image — Creates an image file of ext2 file system data
► fdisk — The standard Linux partition table editor
► fsck — Checks or repairs a file system
► lsraid — Displays information about Linux RAID devices
► mformat — Formats a DOS floppy disk; part of the Mtools suite of tools
► mkfs — Creates various file systems and acts as a wrapper for the actual programs that do the work
► mkisofs — Creates a CD-ROM file system in iso960 format
► mkreiserfs — Creates a Linux reiserfs file system
► mkswap — Prepares a Linux swap device
► mount — Mounts a supported file system
► parted — The GNU partition editor and resizing utility
► reiserfsck — Checks a Linux reiserfs file system
► resize_reiserfs — Resizes a Linux reiserfs file system
► smbmount — Mounts an smbfs file system
► stat — Shows file or file system status
► swapon — Displays swap usage or start using system swap device
► swapoff — Turns off swap usage
► sync — Flushes file system buffers
► tune2fs — Changes file system parameters on ext2 file systems
► umount — Unmounts a file systems
► usermount — The Fedora graphical file system mounting and formatting tool
The First Linux Kernel
In 1991, Linus Torvalds released version .99 of the Linux kernel as the result of his desire for a powerful, Unix-like operating system for his Intel 80386 personal computer. Linus wrote the initial code necessary to create what is now known as the Linux kernel and combined it with Richard Stallman's GNU tools. Indeed, because many of the Linux basic system tools come from the GNU Project, many people refer to the operating system as GNU/Linux. Since then, Linux has benefited as thousands of contributors have added their talents and time to the Linux project. Linus still maintains the kernel, deciding on what will and will not make it into the kernel as official releases, known to many as the vanilla or Linus Linux kernel.
The remaining directories contain the source code for the kernel and the kernel drivers. When you install the kernel sources, these files are placed there automatically. When you patch kernel sources, these files are altered automatically. When you compile the kernel, these files are accessed automatically. Although you never need to touch the source code files, they can be useful. The kernel source files are nothing more than text files with special formatting, which means that we can look at them and read the programmers' comments. Sometimes, a programmer will write an application, but cannot (or often does not) write the documentation. The comments he puts in the source code are often the only documentation that exists for the code.NOTE
The make utility is a very complex program. Complete documentation on the structure of Makefiles, as well as the arguments that it can accept, can be found at http://www.gnu.org/software/make/manual/make.html.
NOTE
The interaction and control of hardware is handled by a small piece of the kernel called a device driver. The driver tells the computer how to interact with a modem, a SCSI card, a keyboard, a mouse, and so on in response to a user prompt. Without the device driver, the kernel does not know how to interact with the associated device.
Some code can be only one or the other (for technical reasons unimportant to the average user), but most code can be compiled either as modular or in-line. Depending on the application, some system administrators prefer one way over the other, but with fast modern processors and abundant system memory, the performance differences are of little concern to all but the most ardent Linux hackers.NOTE
As a common example, drivers for SCSI disk drives must be available to the kernel if you intend to boot from SCSI disks. If the kernel is not compiled with those drivers in-line, the system will not boot because it will not be able to access the disks.
A way around this problem for modular kernels is to use an initial RAM disk (initrd) discussed later in section "Creating an Initial RAM Disk Image." The initrd loads a small kernel and the appropriate device driver, which then can access the device to load the actual kernel you want to run.
CAUTION
You should always rpm -U (upgrade) a new kernel rpm, rather than rpm -i (install), to avoid overwriting the old, but still working, kernel. This is done as a safety measure. What if the new one does not work?
A number of different entries are on the FTP archive site for each kernel version, but because you are interested in only the full kernel, it is necessary to get only the full package of source code. There are two of these packages:NOTE
ftp.kernel.org receives more than its share of requests for download. It is considered a courtesy to use a mirror site to reduce the traffic that ftp.kernel.org bears. http://www.kernel.org/mirrors/ has a list of all mirrors around the world. Find one close to your geographic location and substitute that address for ftp.kernel.org.
CAUTION
The correct symbolic link is critical to the operation of make. Always have the symbolic link point to the version of the kernel sources with which you are working.
Using the patch Command
If you have a special, nonstandard patch to apply — such as a third-party patch for a commercial product, for example — you can use the patch command rather than the special patch-kernel script that is normally used for kernel source updates. Here are some quick steps and an alternative method of creating patched code and leaving the original code alone:
1. Create a directory in your home directory and name it something meaningful, like mylinux.
2. Copy the pristine Linux source code there with cp -ravd /usr/src/kernels/linux-2.6/* ~/mylinux.
3. Copy the patch file to that same directory with cp patch_filename -/mylinux.
4. Change to the ~/mylinux directory with cd ~/mylinux.
5. Apply the patch with patch -p1 < patch_filename > mypatch.log 2>&1. (This last bit of code saves the message output to a file so that you can look at it later.)
6. If the patch applies successfully, you are finished and have not endangered any of the pristine source code. In case the newly patched code does not work, you do not have to reinstall the original, pristine source code.
7. Copy your new code to /usr/src/kernels and make that special symbolic link described elsewhere in the chapter.
2. Apply all patches, if any, so that you have the features you want. See the previous section for details.CAUTION
Before making any changes to your current, working kernel, make sure that you have a backup copy on a floppy disk. This enables you to boot into your system with a known working kernel in case something goes wrong during configuration. The command to do this is as follows:
# mkbootdisk --device /dev/fd0 `uname -r`
This assumes that your floppy drive is /dev/fd0. (Here is a good shell script tip: The ` character tells the shell to execute what is within ` first and then returns that output as part of the input of the mkbootdisk command.) On this machine, the result is the following:
# mkbootdisk --device /dev/fd0 2.6.7-1
This command is not echoed to your screen, but it is what the system executes.
4. Run the make mrproper directive to prepare the kernel source tree, cleaning out any old files or binaries.NOTE
If you are recompiling the Fedora default kernel, the /usr/src/kernels/linux-2.6/configs directory contains several versions of configuration files for different purposes. Fedora provides a full set of .config files in the subdirectory configs, all named for the type of system for which they were compiled. For example, kernel-2.6.7-i686-smp.config is a configuration file for a multiprocessor Pentium-class computer. If you want to use one of these default configurations as the basis for a custom kernel, simply copy the appropriate file to /usr/src/kernels/linux-2.6 and rename it .config.
6. Modify the kernel configuration file using make config, make menuconfig, or make xconfig — we recommend the latter, but read the text following these numbered instructions for more details.NOTE
If you want to keep any current version of the kernel that was compiled with the same code tree, manually edit the Makefile with your favorite text editor and add some unique string to the EXTRAVERSION variable. You can use any description you prefer.
8. Run make clean to prepare the sources for the actual compilation of the kernel.TIP
If you have a multiprocessor machine, you can use both processors to speed the make process by inserting -jx after the make command, where, as a rule of thumb, x is one more than the number of processors you have. You might try a larger number and even try this on a single-processor machine (we have used -j8 successfully on an SMP machine); it loads up only your CPU. For example,
# make -j3 bzImage
All the make processes except make dep work well with this method of parallel compiling.
10. Run make modules to compile any modules your new kernel needs.NOTE
Several choices of directives exist, although the most common ones are as follows:
zImage — This directive compiles the kernel, creating an uncompressed file called zImage.
bzImage — This directive creates a compressed kernel image necessary for some systems that require the kernel image to be under a certain size for the BIOS to be able to parse them; otherwise, the new kernel will not boot. It is the most commonly used choice. However, the Fedora kernel compiled with bzImage is still too large to fit on a floppy, so a smaller version with some modules and features removed is used for the boot floppies. Fedora recommends that you boot from the rescue CD-ROM. bzDisk — This directive does the same thing as bzImage, but it copies the new kernel image to a floppy disk for testing purposes. This is helpful for testing new kernels without writing kernel files to your hard drive. Make sure that you have a floppy disk in the drive because you will not be prompted for one.
Name | Description |
---|---|
Code maturity level options | Enables development code to be compiled into the kernel even if it has been marked as obsolete or as testing code only. This option should only be used by kernel developers or testers because of the possible unusable state of the code during development. |
General setup | Contains several different options covering how the kernel talks to the BIOS, whether it should support PCI or PCMCIA, whether it should use APM or ACPI, and what kind of Linux binary formats will be supported. Contains several options for supporting kernel structures necessary to run binaries compiled for other systems directly without recompiling the program. |
Loadable module support | Determines whether the kernel enables drivers and other nonessential code to be compiled as loadable modules that can be loaded and unloaded at runtime. This option keeps the basic kernel small so that it can run and respond more quickly; in that regard, choosing this option is generally a good idea. |
Processor type and features | Several options dealing with the architecture that will be running the kernel. |
Power management options | Options dealing with ACPI and APM power management features. |
Bus options | Configuration options for the PCMCIA bus found in laptops and PCI hotplug devices. |
Memory Technology Devices (MTDs) | Options for supporting flash memory devices, such as EEPROMS. Generally, these devices are used in embedded systems. |
Parallel port support | Several options for configuring how the kernel will support parallel port communications. |
Plug-and-play configuration | Options for supporting Plug and Play PCI, ISA, and plug-and-play BIOS support. Generally, it is a good idea to support plug-and-play for PCI and ISA devices. |
Block devices | Section dealing with devices that communicate with the kernel in blocks of characters instead of streams. This includes IDE and ATAPI devices connected via parallel ports, as well as enabling network devices to communicate as block devices. |
ATA/IDE/MFM/RLL support | Large collection of options to configure the kernel to communicate using different types of data communication protocols to talk to mass storage devices, such as hard drives. Note that this section does not cover SCSI. |
SCSI device support | Options for configuring the kernel to support Small Computer Systems Interface. This subsection covers drivers for specific cards, chipsets, and tunable parameters for the SCSI protocol. |
Old CD-ROM drivers | Configuration options to support obscure, older CD-ROM devices that do not conform to the SCSI or IDE standards. These are typically older CD-ROM drivers that are usually a proprietary type of SCSI (not SCSI, not IDE). |
Multi-device support | Options for enabling the kernel to support RAID devices in (RAID and LVM) software emulation and the different levels of RAID. Also contains options for support of a logical volume manager. |
Fusion MPT device support | Configures support for LSI's Logic Fusion Message Passing Technology. This technology is for high-performance SCSI and local area network interfaces. |
IEEE1394 (firewire) support I20 device support | Experimental support for FireWire devices. Options for supporting the Intelligent Input/Output architecture. This architecture enables the hardware driver to be split from the operating system driver, thus enabling a multitude of hardware devices to be compatible with an operating system in one implementation. |
Networking support | Several options for the configuration of networking in the kernel. The options are for the types of supported protocols and configurable options of those protocols. |
Amateur radio support | Options for configuring support of devices that support the AX25 protocol. |
IrDA (infrared) support | Options for configuring support of the Infrared Data Association suite of protocols and devices that use these protocols. |
Bluetooth support | Support for the Bluetooth wireless protocol. Includes options to support the Bluetooth protocols and hardware devices. |
ISDN subsystem | Options to support Integrated Services Digital Networks protocols and devices. ISDN is a method of connection to a large area network digitally over conditioned telephone lines, largely found to connect users to ISPs. |
Telephony support | Support for devices that enable the use of regular tele phone lines to support VOIP applications. This section does not handle the configuration of modems. |
Input device support | Options for configuring universal serial bus (USB) human interface devices (HIDs). These include keyboards, mice, and joysticks. |
Character devices | Configuration options for devices that communicate to the server in sequential characters. This is a large subsection containing the drivers for several motherboard chipsets. |
Multimedia devices | Drivers for hardware implementations of video and sound devices such as video capture boards, TV cards, and AM/FM radio adapter cards. |
Graphics support | Configures VGA text console, video mode selection, and support for frame buffer cards. |
Sound | Large subsection to configure supported sound card drivers and chipset support for the kernel. |
USB support | Universal Serial Bus configuration options. Includes configuration for USB devices, as well as vendor-specific versions of USB. |
File system | Configuration options for supported file system types. Refer to Chapter 34 for a description of the file systems supported by the kernel. |
Additional device driver support | Third-party patches. |
Profiling support | Profiling kernel behavior information to aid in debugging and development. |
Kernel hacking | Determines whether the kernel will contain advanced debugging options. Most users do not want to include this option in their production kernels because it increases the kernel size and slows performance by adding extra routines. |
Security options | Determines whether NSA Security Enhanced Linux (SELinux) is enabled. |
Cryptographic options | Support for cryptography hardware (Fedora patches not found in the vanilla kernel sources). |
Library routines | Contains zlib compression support. |
TIP
For best results, go to http://www.google.com/linux to find all things Linux on the Internet. Google has specifically created a Linux area of its database, which should allow faster access to information on Linux than any other search engine. Usenet newsgroup postings are searchable at http://www.google.com/grphp. Mail list discussions can be searched in the Mailing listARChives (MARC) at http://marc.theaimsgroup.com/.
Relevant Fedora and Linux Commands
You will use the following commands when managing the kernel and its modules in Fedora:
► gcc — The GNU compiler system
► make — GNU project and file management command
► mkbootdisk — Fedora's boot disk creation tool
► sysctl — The interface to manipulating kernel variables at runtime
► mkinitrd — Create a RAM-disk file system for bootloading support
One possible reason for the success of Linux could be "best hack wins." In other words, software that works well, fills a critical need, is readily available in source form, and is distributed under a free software license (such as the GNU GPL) will quickly spread and see extensive use. The growth in popularity and widespread adoption of Linux around the world is a testament to quality, licensing, and need for Linux.About Red Hat
Red Hat is one of the world's foremost open source development houses and returns nearly all its development efforts back to the Linux development community.
The company has been involved in many open source and GNU GPL projects, such as the Apache web server, the glibc software libraries, the GNU Network Object Model Environment (GNOME), various GNU software tools and packages, the Linux kernel and device drivers, the PostgreSQL database system, and the Red Hat Package Manager (RPM).
Red Hat also supports many other projects by providing FTP service and web hosting and is one of the few companies actively promoting and using the open source business development model. This means that, although many of its products are free, revenue streams are derived from spin-off and related technologies and services.
NOTE
The list of Linux projects, efforts, and partnerships reads like a Who's Who of the software industry: Amazon, Ameritrade, Borland, Computer Associates, Dell, Hewlett-Packard, IBM, Oracle, and SAP are just some of the enterprise-level players using Linux. Linux is also a key ingredient and shares an ever-increasing portion of server hardware sales from all large vendors, such as IBM, Hewlett-Packard, and Dell.
Distribution Version and Kernel Numbering Schema
There is a specific numbering system for Linux kernels, kernel development, and Fedora's kernel versions. Note that these numbers bear no relation to the version number of your Fedora Linux distribution. Fedora distribution version numbers are assigned by the Fedora Project, whereas most of the Linux kernel version numbers are assigned by Linus Torvalds and his legion of kernel developers.
To see the date your Linux kernel was compiled, use the uname command with its -v command-line option. To see the version of your Linux kernel, use the -r option. The numbers, such as 2.6.23-1.49, represent the major version (2), minor version (6), and patch level (23). The number 1 is the developer patch level, while the final number (49) is the distro-specific version and is assigned by the Fedora Project.
Minor numbers that are even are considered "stable" and generally fit for use in production environments, whereas odd minor numbers (such as a Linux 2.7 source tree) represent versions of the Linux kernel under development and testing. You will find only stable versions of the Linux kernel included with this book. You can choose to download and install a beta (test) version of the kernel, but this is not recommended for a system destined for everyday use. Most often, beta kernels are installed to provide support and testing of new hardware or operating system features.
Small business owners can earn great rewards by stepping off the software licensing and upgrade treadmill and adopting a Linux-based solution. Using Fedora not only avoids the need for licensing accounting and the threat of software audits, but also provides viable alternatives to many types of commercial productivity software.Red Hat Enterprise Linux in Government
Red Hat Enterprise Linux has a presence in many government entities at various levels across the world. For example, the New Jersey State Police use a Red Hat-based Oracle system, whereas India's Centre for Development of Advanced Computing uses Red Hat Linux in its high-performance computing lab.
Use of Linux is expanding rapidly in the U.S. federal sector. Red Hat Enterprise Linux is on the General Services Administration Schedule, and the U.S. National Security Agency has offered a series of kernel patches to assist in building secure versions of Linux. This has quickened the development of SELinux within both Fedora and Red Hat Enterprise Linux. Other agencies and departments, such as the U.S. Air Force, U.S. Marine Corps, Federal Aviation Administration, NASA, and the Departments of Defense, Agriculture, and Energy also use Linux-enabled platform solutions from IBM and Hewlett-Packard.
NOTE
As an example of inter company relationships, most of the large law firms in London have their own soccer teams that regularly meet to do battle on the soccer field. They also meet to discuss IT issues and swap ideas between each other which benefits all of them. Why not set up a local corporate Linux user group in your area? You don't have to make it a sports-related meeting; just make it clear that you want to share ideas and best practice.
One of the great things about Linux is that it allows you to try it before committing your self. What other operating system do you know that can be booted up from a single CD and allow you to have a fully operational system, complete with applications? Although it sound like black magic, this kind of thing actually exists in the form of Live CDs and there are plenty to choose from, including the two that are available for Fedora (Gnome and KDE based). Boot your system with one of these CDs to give you an idea of how well your hardware will cope with Linux.NOTE
Browse to Red Hat's Migration Center at http://www.redhat.com/business/utol/success/ to read success stories, market analyses, and technical reports on using Red Hat's Enterprise Linux products for business.
Consideration | Description |
---|---|
Applicability | How is Fedora going to be used? |
Boot management | Will remote booting be required? |
Connectivity | Will the system be used in an internal network, or connected to the Internet? Is there a requirement for wireless connectivity? What about bandwidth? |
Context | How does this install fit in with academic, business, or corporate needs? |
Consensus | Are managers and potential users on board with the project? |
Comparison | Is this install part of platform comparison or benchmarking? |
Development platform | Will development tools be used? |
Embedded device | Is it an embedded device project? |
Hardware | Are there any special hardware or device interfacing requirements? |
Finance | How much is in the budget? Will cost comparison be required? |
Marketing | Will a product or service be offered as a result? |
Networking | What type of networking will be required? |
Objective | Is there a specific objective of the install? |
Pilot project | Is this a pilot or test install? |
Power management | Any special power or energy requirements? |
Public relations | Does the public need to know? |
Quality of service | Is high availability or data integrity an issue? |
Roadmap | What other steps might precede or follow the install? |
Reporting | Are follow-up reports required? |
Security | What level or type of security will be required? |
Server | Is this a server installation? |
Site considerations | Does the location provide needed temperature and security, or does it even matter? |
Software | Are any special device drivers needed for success? |
Storage | Are there size or integrity needs? Has a backup plan been devised? |
Timeline | Are there time constraints or deadlines to the install? |
Training | Will special training be required for users or administrators? |
Users | How many and what type of users are expected? |
Workstation | Is this a workstation or personal desktop install? Is the workstation portable? |
The type of deployment you choose also determines the hardware required for a successful deployment of Linux — and post-deployment satisfaction. The range of Linux hardware requirements and compatible hardware types is quite wide, especially when you consider that Linux can be used with mainframe computers as well as embedded devices.TIP
It is always a good idea to explore your hardware options extensively before jumping on board with a specific vendor. You can buy computer hardware with a Linux distribution preinstalled. At the time of this writing, Dell Computer offered systems complete with Red Hat Enterprise Linux (such as desktop PCs and workstations) through http://www.dell.com/redhat/. IBM also offers Linux on its product line, and more information can be found through http://www.ibm.com/linux/. To find HP and preinstalled Linux systems, browse to http://www.hp.com/linux/. You can also buy low-cost desktop PCs with Linux through Wal-Mart's online store at http://www.walmart.com (click to select the electronics department).
The Fedora installer no longer provides different installation classes. Instead it allows you a lot of control over the software that you want to install. However, you can specify whether you want to install tools for productivity and development and can specific packages according to your exact requirements. Fedora computes the storage space required when you are selecting packages, so you can always be sure that you have sufficient hard drive space before it starts to install. Of course, if you are after a minimalist installation, here are some software packages you might want to consider passing up in the installation process for as small a system as possible:NOTE
The following recommended installations and minimal storage requirements are based on a full install of the freely available version of Fedora distributed on the Internet. The copy of Fedora included with this book is the same, but you might find many additional software packages available from third-party Fedora contributors. Installing additional software affects your storage requirements.
Specific issues regarding Linux hardware compatibility can be researched online at a number of sites. A pretty good place to visit if you want to know about general hardware compatibility with Linux is http://www.linuxquestions.org/hcl/index.php; this covers a wide range of hardware devices and peripherals.NOTE
The compatibility information in this appendix relates to Fedora. Other distributions might have different storage and CPU requirements. Also bear in mind that Fedora is available for x86-64 and PPC architectures, too. Consult the release notes to get a detailed specification for these versions.
If you cannot find compatibility answers in various online databases, continue your research by reading the Linux Hardware HOWTO at http://www.tldp.org/HOWTO/ Hardware-HOWTO/. At that address, you will find loads of general information and links to additional sources of information.TIP
A company called EmperorLinux in the United States supplies laptops from prominent manufacturers with Linux preinstalled complete with support. They have been in business for a few years now, and ensure 100% compatibility with the laptops that they sell. Check out their range athttp://www.emperorlinux.com.
Item | Errata |
---|---|
Audio devices | Microphone: |
Line out: | |
Line in: | |
BIOS | Type: |
Revision: | |
ACPI: | |
APM: | |
CD-ROM drive | Brand: |
Type: | |
CD-RW drive | Brand: |
Type: | |
CD-R write speed: | |
CD rewrite speed: | |
CD-ROM read speed: | |
DVD drive | Brand: |
Type: | |
DVD+/-RW drive | Brand: |
Type: | |
Dual layer?: | |
Digital camera | Brand: |
Model: | |
Interface: | |
CPU | Brand: |
Socket type: | |
Speed: | |
FireWire (IEEE 1394) | Chipset: |
Device(s): | |
IrDA port | Device number: |
Port IRQ: | |
Keyboard | Brand: |
Type: | |
Laptop | Brand: |
Model: | |
Hibernation partition: | |
Legacy ports | Parallel type: |
Parallel IRQ: | |
RS-232 number(s): | |
RS-232 IRQ(s): | |
Mice | Brand: |
Type: | |
Modem | Brand: |
Type: | |
Motherboard | Brand: |
Type: | |
Chipset: | |
Monitor(s) | Brand: |
Model: | |
Horizontal freq: | |
Vertical freq: | |
Max. resolution: | |
Network card | Wireless: |
Brand: | |
Type: | |
Speed: | |
PCI bus | Version: |
Model: | |
Type: | |
PCMCIA | Controller: |
Cardbus: | |
Brand: | |
Type: | |
Printer(s) | Brand: |
Model: | |
System RAM | Amount: |
Type: | |
Speed: | |
S-Video port | X Support: |
Scanner | Brand: |
Model: | |
Interface type: | |
Sound card | Chipset: |
Type: | |
I/O addr: | |
IRQ: | |
DMA: | |
MPU addr: | |
Storage device(s) | Removable: |
Size: | |
Brand: | |
Model: | |
Controller(s): | |
Storage device controller | Type: |
Tablet | Brand: |
Model: | |
Interface: | |
Universal Serial Bus | Controller: |
BIOS MPS setting: | |
BIOS Plug-n-Play setting: | |
Device(s): | |
Video device(s) | Brand: |
Model: | |
Xinerama: | |
Chipset: | |
VRAM: |
There are many different ways to install Fedora, and selecting an installation method might depend on the equipment on hand, existing bandwidth, or equipment limitations. Here are some of the most commonly used installation methods:TIP
You can use the first Fedora CD or the DVD to perform other tasks aside from installing Linux. The CD-ROM/DVD features a rescue mode and you can also use it to partition and prepare a hard drive for Linux, using fdisk as described earlier.
NOTE
It is possible to create a dual-boot configuration, which allows the choice of booting Fedora and another operating system, such as Windows XP To configure your system for dual booting, you must first install Windows and then install Linux. Note that many Windows system-restore CD-ROMs wipe out all data on your hard drive, including Linux. During installation of Fedora, you install the GRUB Linux bootloader in the primary drive's Master Boot Record, or MBR. When properly configured, GRUB allows your system to reboot to Windows or Linux. Browse to http://www.gnu.org/software/grub/manual/ to read the GRUB manual online.
The simplest and most basic partitioning scheme for a Linux system requires a Linux native root partition and a swap partition. On a single-drive system with 12GB storage and 512MB of RAM, the scheme might look like this:CAUTION
Before you begin partitioning your drive, get your safety nets in order. First, back up all critical data! Any changes to your system's hard drive or operating system put your existing data at risk. To prevent the loss of time and resources that inevitably follow data loss, do full backups before you make any changes to your system. Create a bootdisk during the install (you will be asked before the install finishes) so that you will be able to at least boot Linux if something goes wrong.
CAUTION
Notebook users should be careful when partitioning. Some notebooks use a special partition equal to the size of installed RAM to perform suspend-to-disk or other hibernation operations. Always examine your computer's initial partitioning scheme if configuring a dual-boot system, and leave the special partition alone! One way around this problem is to use a software suspend approach as outlined athtpp://www.suspend2.net/.
TIP
As a general rule, it is a good idea to segregate user and system data. Although a Linux system can be restored quickly, user data has a much greater value and can be much more difficult to replace. Segregating data can make the job of backing up and restoring much easier. If you ever have a problem accessing your partition, we recommend that you get the excellent Knoppix distribution that boots and runs entirely from CD. This will enable you to access your partitions and make any necessary repairs.
To begin the automated installation process, you create the configuration file that will be used by kickstart as an installation profile. You can configure the complex configuration file with Fedora's Kickstart Configurator. To start the configuration, click the Kickstart item from System, Administration menu, or enter the system-config-kickstart command, like so:TIP
Fedora does not automatically install system-config-kickstart, the utility used to create and customize system-config-kickstart files. Be sure that you install it, using either yum or the Add/Remove Programs tool.
This appendix also lists websites that might be of general interest when using Fedora or specific components such as Xorg. Every effort has been made to ensure the accuracy of the URLs, but keep in mind that the Internet is always in flux!If You Need Help 24/7
If you are a small business, corporate, or enterprise- level Red Hat Enterprise Linux user, do not forget that you can always turn to the source, Red Hat, or third- party companies, such as Dell and HP who supply Red Hat servers for commercial technical support on a 24/7 onsite basis, by phone, by electronic mail, or even on a per-incident basis. Red Hat offers a spectrum of support options for its software products. You can read more about support options when you purchase Red Hat software at https://www.redhat.com/apps/commerce/. Remember that Fedora is not an officially supported product from Red Hat. If you want help, try http://fedoraforum.org.
Keep Up-to-Date with yum
Keeping informed about bug fixes, security updates, and other errata is critical to the success and health of a Fedora system. To keep abreast of the most important developments when using Fedora, be sure to register with the Fedora Announcements mailing list. The list tells you about updates that have been issued and what has been fixed as a result. Go to http://www.redhat.com/mailman/listinfo/fedora-announce-list to register for this mailing list. At the very least you should use the updater applet, or puplet as it's affectionately known, to ensure that you are up-to-date with all the patches, bug fixes, and security updates that are available for your system. Alternatively, if you are taken with the command line, you could also use the yum update command (as root) to do the same thing.
The Benefits of Joining a Linux User Group
Join a local Linux Users Group (LUG)! Joining and participating in a local LUG has many benefits. You can get help, trade information, and learn many new and wonderful things about Linux. Most LUGs do not have membership dues, and many often sponsor regular lectures and discussions from leading Linux, GNU, and open source experts. For one great place to start, browse to http://www.tux.org/luglist.html. Another great place to meet up with like-minded people is at one of the numerous Linuxworld shows held around the world. Head on over to http://www.linuxworldexpo.com/flash/ for a list of international shows.
GNOME and KDE Mailing Lists
GNOME users and developers should know that more than two dozen mailing lists are available through http://mail.gnome.org/. KDE users can also benefit by perusing the KDE-related mailing lists at http://www.kde.org/mailinglists.html.
Ñïàñèáî, ÷òî ñêà÷àëè êíèãó â áåñïëàòíîé ýëåêòðîííîé áèáëèîòåêå BooksCafe.Net
Îñòàâèòü îòçûâ î êíèãå
Âñå êíèãè àâòîðà