- •About the Author
- •Credits
- •How This Book Is Organized
- •Part I: Linux Basics
- •Part II: Installation
- •Part III: Configuration
- •Part IV: Administration
- •Part V: Maintaining the Linux System
- •How Each Chapter Is Structured
- •How to Use This Book
- •Conventions Used in This Book
- •What is Linux?
- •The origin of UNIX
- •Who started Linux?
- •Understanding Open Source
- •Understanding Closed Source
- •Understanding Artistic License
- •Is Freeware really free?
- •Is Shareware never free?
- •A comparison and contrast of licensing methods
- •The Growth of Linux
- •Linux on a Personal Computer
- •Graphical installation
- •Hardware detection
- •Graphical user interface
- •Linux limitations on the PC
- •Linux succeeds on the PC
- •Linux on workstations
- •Linux on servers
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Linux Kernel
- •Kernel versions
- •Kernel availability
- •Linux Distributions
- •Beehive
- •BlueCat
- •Caldera OpenLinux
- •Debian
- •Corel
- •DragonLinux
- •Elfstone
- •Gentoo
- •Hard Hat Linux
- •KRUD
- •LinuxPPC
- •Mandrake
- •Phat Linux
- •Slackware
- •StormLinux
- •SuSE
- •TurboLinux
- •Yellow Dog Linux
- •Mini and Specialty Distributions
- •Astaro
- •KYZO
- •FlightLinux
- •NetMAX
- •Packages and Packaging Solutions
- •Red Hat Package Manager
- •Debian Package Management System
- •Tarball
- •Linux Resources
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Linux In the Real World
- •Word Processing
- •Spreadsheets and databases
- •Web browsing
- •File transfer
- •More, more, and more applications
- •The Server and DNS
- •A Linux Web server
- •Linux e-mail server
- •File servers
- •Proxy, news, and search servers
- •FTP servers
- •Firewalls
- •Determining Linux Roles and Services
- •Comparing Linux with other operating systems
- •Hardware compatibility
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Installing Linux
- •Final Preparations for Installation
- •Verification
- •Package selection
- •Final hardware verification
- •Pre-installation partitioning planning
- •Installing Linux
- •Text or GUI installation
- •Basic setup of Linux
- •Selecting the machine type
- •Partitioning the hard disk drive
- •Installing a boot manager
- •Creating the Boot Diskette
- •Networking
- •Additional installation information
- •Accounts and passwords
- •Additional packages to install
- •GUI installation
- •Obtaining video card information
- •Configuring the X windows system
- •Selecting the windows manager or desktop environment
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Answers to Assessment Questions
- •Scenarios
- •Alternative to the GUI Installation
- •Command Line installation
- •Install the Linux system
- •Network installations of Linux
- •Review of a Linux Installation
- •Installation media
- •Initial selections
- •Installation type or class
- •Disk partitioning and formatting
- •Installing LILO
- •Network configuration
- •User accounts
- •Authentication methods
- •Package selection and installation
- •A Dual-Boot Installation of Linux
- •Linux with Microsoft Windows
- •Linux with Microsoft Windows NT and 2000
- •Linux and Solaris
- •Linux and other operating systems
- •Installing Additional Software with gzip and tar
- •Installing Additional Software with RPM
- •Removing software with RPM
- •Upgrading software with RPM
- •Query the RPM software
- •Verify the RPM software
- •Verify the package files
- •Upgrading the Kernel
- •Upgrading a Linux Kernel
- •System Log Files
- •The Final Test of the Installation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •What is the X Window System?
- •The X Window System
- •X Client and Server communications
- •X Window Manager
- •Configuring X Window Systems
- •Custom X Window System Programs
- •Manual Configuration of the X Window System
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Basic Network Services
- •TCP/IP Protocol Suite
- •Connection protocols needed
- •Other network protocols
- •Configuring Basic Network Services
- •Host name
- •IP addressing
- •DHCP
- •Netmask
- •Hardware resources
- •Routing and gateways
- •PPP, SLIP and PLIP connections
- •Server Tasks with
- •IP aliases for virtual hosts
- •Apache Web Server
- •Samba File Server
- •Home directories
- •Disk shares
- •Configuring Client Services
- •SMB/CIFS
- •NIS client configuration
- •NFS client configuration
- •Configuring Internet Services
- •Web browser
- •POP and SMTP
- •TFTP
- •SNMP
- •Remote Access
- •Rlogin
- •Telnet
- •OpenSSH
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Adding Hardware
- •Memory
- •Swap
- •Adding a hard drive
- •Video and monitor
- •Printers
- •Configuration files
- •Setting environment variables
- •BASH
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Basic User and Group Administration
- •What are users and groups?
- •Creating users
- •Change user information
- •Deleting users
- •Creating groups
- •Getting Around Linux
- •Navigating Linux
- •Common file and directory commands
- •Setting File and Directory Permissions
- •Mounting and Managing File Systems
- •Mount
- •Umount
- •Mounted file systems
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Multi-User Environment
- •The creation of Virtual Consoles
- •The Linux Terminal Server Project
- •Configurations for remote systems
- •Monitoring remote connections
- •Common Shell Commands
- •Basic shell scripts
- •Caution using root access
- •Navigating the GUI interface
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Runlevels
- •init
- •Shutting down Linux
- •Managing Linux Services
- •Configuring Linux Printing
- •lpd daemon
- •/etc/printcap
- •Printing management
- •Using the vi Editor
- •vi operation modes
- •Editing text files
- •Using the
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Disk and File System Management
- •Repairing Partitions
- •System Automation and Scheduling
- •cron
- •Core Dumps
- •Analyzing core dumps
- •GNU Debugger
- •Managing Networking Interfaces
- •Installing System Packages and Patches
- •Compressed archive
- •Debian Package Installer
- •Slackware Package Installation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Processes
- •Core services versus non-critical services
- •Process administration
- •Process control
- •Monitoring Log Files
- •Maintaining Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Security
- •Securing the Environment
- •Location
- •Environment
- •System Security
- •System/user files
- •Permissions
- •Log auditing
- •Backups
- •Linux Security Best Practices
- •Network security
- •Firewall
- •System security
- •Securing a Web server
- •Securing an FTP server
- •FTP program version
- •FTP configuration files
- •Process security
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Disaster Recovery Planning
- •Types of data
- •Frequency and Scheduling
- •Storage and media types
- •Recovering data
- •Offsite storage
- •Linux Backup Tools and Commands
- •Third party tools
- •Tape devices
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Identifying the Problem
- •Methodology and Best Practices
- •Troubleshooting Resources
- •Documentation resources
- •Internet resources
- •System Log Files
- •Tools for Log Files
- •Output to another file
- •Locating files
- •Process Configuration and Management
- •Stopping, Starting, and Restarting Processes
- •Configuration Files
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Examining the Startup Process
- •Boot process steps
- •Analyzing Boot Process Errors
- •Common Boot Problems
- •Using System Status Tools
- •File System Check
- •System Resource Commands
- •Using the System Boot Disk
- •Types of boot disks
- •Creating a boot disk
- •Creating a rescue/utility disk
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Common User Problems
- •Login problems
- •File and directory permissions
- •Printing problems
- •Mail problems
- •Software Package Problems
- •Package dependencies
- •Software and version conflicts
- •Backup and Restore Errors
- •Backup hardware
- •Backup software
- •File restore errors
- •Application Failures
- •Log files
- •Process and daemon errors
- •Web server errors
- •Telnet
- •Mail services
- •Basic Networking Troubleshooting
- •Networking connectivity
- •Network hardware problems
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Mainboard Components
- •BIOS
- •System memory
- •System Resources
- •I/O addresses
- •Direct memory access
- •Laptop Considerations
- •PCMCIA
- •Linux Peripheral Configuration
- •Installing and Configuring SCSI Devices
- •SCSI definitions
- •SCSI technologies
- •SCSI cabling and termination
- •SCSI device configuration
- •Linux SCSI devices
- •ATA/IDE Devices
- •IDE drive configuration
- •Linux ATA/IDE Drive configuration
- •Linux Support for Other Devices
- •IEEE 1394 (Firewire)
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •What’s on the CD-ROM
- •System Requirements
- •Using the CD with Microsoft Windows
- •Using the CD with Linux
- •Microsoft Windows applications
- •Linux applications
- •Troubleshooting
- •Sample Exam
- •Exam Questions
- •Exam Answers
- •Taking a CompTIA Exam
- •How to register for an exam
- •What to expect at the testing center
- •Your exam results
- •If you don’t receive a passing score
- •About the Linux + Exam
- •Preparing for the Linux+ Exam
- •For More Information
- •Preamble
- •No Warranty
- •Glossary
- •Index
Chapter 9 General Linux Administration 307
|
Table 9-12 |
|
Options of rmdir |
|
|
Option |
Description |
|
|
--ignore-fail-on-non-empty |
Ignore failures that are the result of a non-empty directory. |
|
|
-p, --parents |
Remove the directory, and then attempt to remove each part |
|
of the path name. |
|
|
--verbose |
Print a message for each removed directory. |
|
|
--help |
Provide help with the program. |
|
|
--version |
Provide version information about the program. |
|
|
The rmdir command looks like this:
[user@dhcppc1 user]$ ls /home/user Desktop/ mydir/ myfile2 nsmail/ tmp/
[user@dhcppc1 user]$ rmdir --verbose /home/user/mydir rmdir: removing directory, /home/user/mydir [user@dhcppc1 user]$ ls /home/user
Desktop/ myfile2 nsmail/ tmp/
Setting File and Directory Permissions
4.4 Identify and change file permissions, modes and types by using chmod, chown and chgrp
Administrators not only have to navigate files and directories, they must also control access to these files and directories. To do this, the administrator must use several commands to restrict file and directory use. For example, log in as a standard user and then attempt to cd into the /root or another user directory. Attempting this action returns the following information:
[user@dhcppc1 user]$ cd /root bash: cd: /root: Permission denied [user@dhcppc1 user]$
308 Part IV Administration
This information shows that the /root directory has permissions that deny most users from having access, as shown in the following:
drwx------ |
9 root |
root |
888 Aug 4 22:05 root/ |
This information shows that the root directory is not available to anyone but the root user. To change the permissions to a file or directory, use several tools, such as chmod, chown and chgrp, to control access.
The chmod command
The chmod command enables you to change file access permissions in Linux. This command uses the following format: chmod [OPTION]... {MODE | --reference=FILE} FILE, and can use OCTAL-MODE instead of MODE, with the symbolic mode format shown as [ugoa...][[+-=][rwxXstugo...]...][,...].
The following characters, shown with the meaning of their letters and symbols, select the new permissions for the file or directory:
Owner types
u = The user who owns it
g = Other users in the file’s group
o = Other users not in the file’s group
a = All users
Permission actions
+ = Selected permissions are added to the existing permissions of each file
- = Selected permissions are removed from the existing permissions of each file
= = Selected permissions are assigned as the only permissions of each file
Permission types
r = Read
w = Write
x = Execute for files or access for directories
X = Execute only if the file is a directory or already has execute permission for some user
s = Sets user or group ID on execution
t = Saves program text on swap device
u = The permissions that the user who owns the file currently has for the file
Chapter 9 General Linux Administration 309
g = The permissions that other users in the file’s group have for the file
o = The permissions that other users, not in the file’s group, have for the file
a = All users
The octal uses 4 bits (0-7) represented as 4, 2, and 1 (adds to 7), with the first digit used to set the user ID (4), group ID (2), or save the text image attributes (1). The second digit is used to select permissions for the user who owns the file, the third digit is used to select permissions for other users in the file’s group, and the fourth digit is used to select the permissions for other users not in the file’s group; all use 4 for read, 2 for write, and 1 for execute. The chmod command also uses the options shown in Table 9-13.
|
|
Table 9-13 |
|
|
Options of chmod |
|
|
|
Option |
Description |
|
|
|
|
-c |
--changes |
Similar to verbose but only reports when a change is made. |
|
|
|
-f |
-- silent --quiet |
Suppresses most error messages. |
|
|
|
-R |
--recursive |
Changes files and directories recursively. |
|
|
|
--reference=RFILE |
Uses RFILE’s mode instead of MODE values. |
|
|
|
|
--verbose |
This option prints a message for each file processed. |
|
|
|
|
--help |
Provides help with the program. |
|
|
|
|
--version |
Provides version information about the program. |
|
|
|
|
The basic use of the chmod command looks similar to the following:
[user@dhcppc1 user]$ chmod --verbose 4420 myfile mode of myfile changed to 4420 (r-S-w----) [user@dhcppc1 user]$
This command can be used to change the permissions on directories, as well as files, and should be used with care because it may cause access issues if used improperly.
The chown command
Use the chown command to change the user and/or group ownership of each listed \ file, which you can do by taking the first non-option argument in the standard
310 Part IV Administration
format of the chmod command — chown [OPTION]... OWNER[.[GROUP]] FILE. If the first option is only a user name, or UID, then that user is made the owner of all files listed. If the user name is followed by a colon or period and a group name with no spaces, then the group ownership is also changed. If no group is included, but the colon (:) or period (.) is included, then the user’s login group is assigned group ownership. This command can also omit the user name and include only the period or colon and group to change the group ownership of the files listed; this is the same function as chgrp. The options available to the chown command are shown in Table 9-14.
|
|
Table 9-14 |
|
|
Options of chown |
|
|
|
Option |
Description |
|
|
|
|
-c |
--changes |
Similar to verbose but only report when a change is made. |
|
|
|
-f |
-- silent --quiet |
Suppresses most error messages. |
|
|
|
-h |
|
This option affects symbolic links instead of the referenced file. |
|
|
|
-R |
--recursive |
Change files and directories recursively. |
|
|
|
--reference=RFILE |
Uses RFILE’s mode instead of MODE values. |
|
|
|
|
--verbose |
This option will print a message for each file processed. |
|
|
|
|
--help |
Provide help with the program. |
|
|
|
|
--version |
Provide version information about the program. |
|
|
|
|
The chown command often looks like the following (for the file ‘newfile’, created by user, in the directory /tmp):
[root@dhcppc1 /home]# chown --verbose user2 /tmp/newfile owner of /tmp/newfile changed to user2
The chgrp command
The change group command uses the following format: chgrp [options] GROUP FILE. This command works very similarly to the chown command, but is used to only change group ownership of a file. The chgrp command uses the same options