Полезная информация


UNIX® Unleashed, System Administrator's Edition

Robin Burk and David B. Horvath, CCP, et al


To Stephen P. Kowalchuk, who provided an IS manager and practicing network administrator's point of view.

----Robin Burk

This edition is dedicated to my parents and grandparents. Education and doing one's best was always important to them.

----David B. Horvath


Special thanks to Roger for support and grocery shopping. Also to the Laurelwood English Cockers, who intuitively understand how to negotiate a communications session (beg), allocate resources (if it's on the counter, it's ours!), and travel in encapsulated cells (show crates) over broadband highway networks.

----Robin Burk

As with all the other projects I get involved with, my wife and muse, Mary, has been tremendously supportive. Even when I spent my evenings and weekends at the keyboard. Of course, she filled her time by shopping (she said this, not me).

My parents, brothers, and the rest of family, who always wondered about the time I spent with computers, are now seeing the concrete results of it all.

I've been involved with this project for close to a year now. The development staff were very helpful and have certainly kept it interesting. I want to thank them and the other authors (especially those that I talked into helping out). This certainly turned out to be a bigger project (and resulting book) than any of us expected. I hope and expect that people will be looking at these two volumes as the definitive reference!

After I take a short rest, I will be looking for the next project. Although these things are really tiring, especially with the effort this one entailed, I miss them when I'm not working on one.

---- David B. Horvath

About the Authors

Robin Burk has over 25 years' experience in advanced software, computer, and data communications technologies. She has provided technical and managerial leadership for the development of language tools, communications software, operating systems, and multimedia applications. A successful executive in entrepreneurial companies, she consults on software product development and the use of the Internet for business success. Robin's undergraduate degree is in physics and math. She also holds an MBA in finance and operations. Robin's other passion is breeding, training, and showing dogs. She moderates an e-mail list for English Cocker Spaniel fanciers and can be reached at robink@wizard.net.

David B. Horvath, CCP, is a Senior Consultant with CGI Systems, Inc., an IBM Company, in the Philadelphia, Pennsylvania area. He has been a consultant for over twelve years and is also a part-time Adjunct Professor at local colleges teaching topics that include C Programming, UNIX, and Database Techniques. He is currently pursuing an M.S. degree in Dynamics of Organization at the University of Pennsylvania. He has provided seminars and workshops to professional societies and corporations on an international basis. David is the author of "UNIX for the Mainframer" and numerous magazine articles.

When not at the keyboard, he can be found working in the garden or soaking in the hot tub. He has been married for over ten years and has several dogs and cats.

David can be reached at unx2@cobs.com for questions related to this book. No Spam please!

Fred Trimble holds a master's degree in computer science from Villanova University. In his nine years with Unisys Corporation, he held many positions, including UNIX system administrator, C programmer, and Oracle database administrator. Currently, he is a senior consultant and instructor with Actium Corporation in Conshohocken, Pennsylvania, specializing in C++, Java, and the Brio data warehousing product line. He is currently pursuing a master's degree in software engineering from Drexel University.

Sanjiv Guha has 14 years of experience in managing and developing financial and other application systems. He specializes in C, UNIX, C++, Windows, and COBOL. Sanjiv holds a Master of Technology Degree from Indian Institute of Technology, New Delhi, India.

William A. Farra's computer career started in the summer of 1978, working in a time sharing shop on a IBM 365. It had 768 KB, 8 disk packs totaling 125 MB and a cost of 10 million dollars. That fall, Mr. Farra went to the University of Delaware for electrical engineering and worked part time at Radio Shack playing with the trash 80's. He continued to work for the Shack until he met a bright guy who was writing custom programs for the larger computers the Shack sold. Bill took a full time job with him in September of 1983, working on Microsoft's first versions of UNIX (called Xenix at the time) and writing BASIC and C code.

In 1985, Bill went out on his own for six years, writing UNIX-based data processing systems for various clients in the Philadelphia area including "Dan Peter Kopple and Associates," the architects who renovated 30th Station. Since 1991, Bill has returned to employment, developing and/or enhancing various systems including "Fraud Detection Delivery System" for MBNA and Settlement systems for EPS "MAC card ATM processor." Recently he got away from the "Big Cities" and is living at the Jersey Shore. He is a lead developer for National Freight Industries, working with various UNIX based systems including real-time tracking of vehicles using national transportation satellite and ground-based networks. Always keeping an eye on the future, Bill is just having more fun doing it now.

Richard E. Rummel, CDP, is the president of ASM Computing, Jacksonville, Florida, which specializes in UNIX software development and end user training. He has been actively employed in the computer industry for over 20 years. Married for 25 years, he is the father of two children, a dog, and a cat.

Sriranga Veeraraghavan is earning his B.E. from UC Berkeley in 1997. He is a GUI designer on UNIX, and currently uses Java for multiple Web-based applications. He is currently working at Cisco Systems. Sriranga amuses himself with Perl, Marathon and MacsBugs.

Christopher Johnson is currently studying at Sheffield Hallam University in the UK for a degree in Electronic and Information Engineering. He is mostly self taught in the computer field, with experience being gained from helping other students, people on Usenet, and colleagues at work. He is part of a team that administers a Linux server on the university's network, and administers a web server on it. When not working, his interests include cycling and music, and he enjoys traveling.

John Valley lives in Richmond, Virginia with his wife Terri and his Labrador retriever, Brandon. Mr. Valley currently operates a small practice as an independent consultant for UNIX and Windows tools and applications. With more than 20 years of experience in the computer industry, his background ranges from Cobol business applications and mainframe operating system development to UNIX tools and Windows programming. He teaches courses in C/C++ programming and UNIX fundamentals.

Mr. Valley has published three books on UNIX topics and was a contributing author for the first edition of UNIX Unleashed.

Sydney S. Weinstein, CDP, CCP, is a consultant, columnist, lecturer, author, professor, and president of Myxa Corporation, an Open Systems technology company specializing in helping companies move to and work with Open Systems. He has 20 years experience with UNIX dating all the way back to Version 6.

Sean Drew is a distributed object software developer, working primarily with UNIX, C++, and CORBA. Sean is married to his college sweetheart Sheri and together they have two children, Dylan Thomas and Terran Caitlin. At the time of this writing a third child is on the way, and depending on the gender will probably be named Erin Nichole, Brenna Nichole, or Ryan Patrick. When Sean is not busy with his family or church, he likes to brew beer. Anybody up for a nice imperial stout? Sean can be reached at ninkasi@worldnet.att.net.

Eric Goebelbecker has been working with market data and trading room systems in the New York City area for the past six years. He is currently the Director for Systems Development with MXNet Inc, a subsidiary of the Sherwood Group in Jersey City, New Jersey, where he is responsible for developing new market data and transaction distribution systems.

Ron Rose is an international management consultant with over 20 years of data processing management experience. He has led large-scale data processing installations in Asia, Europe, and the United States, and he has managed several software product start-up efforts. He completed a master's in information systems from Georgia Institute of Technology after completing undergraduate work at Tulane University and the University of Aberdeen, Scotland.

Lance Cavener is co-founder of Senarius. His function is to provide support to employers in Eastern Canada. Tasks such as payroll, work force deployment, and more are part of his business. He is also the President and Senior Network Administrator of ASCIO Communications, a subsidiary of Senarius. He provides the public and businesses with Internet related services. Lance has been actively involved in UNIX since 1990, as an administrator for corporate networks at various companies in Eastern Canada. His work includes working with BIND/DNS, Sendmail, Usenet setup, web servers, and UNIX security. He has also written various programs for SunOS, MS-DOS, MS-Windows, and VMS.

David Gumkowski currently is a senior systems analyst for Digital Systems Group, Inc., Warminster, PA. Nineteen years ago, he emerged from his computing womb at Purdue University and cut his system administration teeth using Control Data and Texas Instruments machines. For the last 11 years, he developed his UNIX skills prodding Sun, Hewlett Packard, Digital Equipment and Silicon Graphics machines to behave for approximately 3,000 users. He would publicly like to thank his wife and children for their support when trying new things like writing chapters for this book.

John Semencar is a senior software analyst for Thomas Jefferson University, Philadelphia, PA. Beginning system administration on Control Data legacy systems 10 years ago, and with a background that also includes DEC and SGI, he presently surrounds himself with Hewlett Packard 9000 servers running HP-UX v10.x. He would like to thank his wife Georgia and little Buster for their support.

Steve Shah is a systems administrator for the Center of Environmental Research and Technology at the University of California, Riverside. He received his B.S. in Computer Science with a minor in Creative Writing from UCR and is currently working on his M.S. there as well. In his copious spare time, he enjoys writing fiction, DJing, and spending time with his friends, family, and sweet, Heidi.

Daniel Wilson currently performs UNIX Systems Administration and Database Administration work for the Defense Finance and Accounting Services Financial Systems Organization, which is a financial organization within the Department of Defense.

William D. Wood currently works at Software Artistry, Inc as a support specialist on UNIX systems. He supports the Expert Advisor software it runs on SUN OS, HP-UX and IBM AIX. He has specialized in multi-systems and remote systems support since 1985, when he started work at the Pentagon. He has solely supported infrastructures that span the world and just the U.S. He has also supported up to 80 UNIX machines at one time.

William G. Pierce currently performs UNIX Systems Administration and is the Technical Lead for the MidTier Management Operation at the Defense Finance and Accounting Services, Financial Services Organization, Indianapolis, Indiana.

Salim M. Douba (Salim_Douba@ott.usconnect.com) is a senior computer network consultant mainly specializing in UNIX, NetWare, and mainframe connectivity. He also designs and implements TCP/IP-based networks and enterprise network management solutions. Salim holds a master's degree in electrical engineering from the American University of Beirut. His experience and main career interests have primarily been in internetworking, multiplatform integration, and network analysis and management.

Chris Byers is a systems administrator for a financial securities firm in Philadelphia. As a former consultant and disaster recovery specialist, he has many years of experience in the UNIX world with its many different variants. He lives in South Jersey with his wife, his son, and his cat. He can be reached at southst@voicenet.com.

Jeff Smith is a psychology major who took a wrong turn and ended up working with computers. Jeff has worked with UNIX systems since 1982 as a programmer and systems administrator. He has administered mail, news, security, and the domain name system on several varieties of UNIX including 2.9 BSD, 4.3 BSD, Dynix, SunOS, and AIX.

James C. Armstrong, Jr. is a software engineer with more than ten years of industry experience with UNIX and C.

James Edwards (jamedwards@deloitte.ca) is an IT professional experienced in data communications, network integration, and systems design in both North America and Europe. He holds an M.S. in information technology from the University of London and a B.A. (Hons) from Middlesex University, both in the United Kingdom. James currently resides in Toronto, Canada, where he is employed as a manager with the Deloitte & Touche Consulting Group. His spare time is taken up with his girls, Denise, Lauren, and Poppy.

Tell Us What You Think!

As a reader, you are the most important critic and commentator of our books. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way. You can help us make strong books that meet your needs and give you the computer guidance you require.

Do you have access to the World Wide Web? Then check out our site at http://www.mcp.com.

[BEG]NOTE:[END] If you have a technical question about this book, call the technical support line at 317-581-3833 or send e-mail to support@mcp.com.

As the team leader of the group that created this book, I welcome your comments. You can fax, e-mail, or write me directly to let me know what you did or didn't like about this book--as well as what we can do to make our books stronger. Here's the information:

Fax: 317-581-4669
E-mail: opsys_mgr@sams.mcp.com
Mail: Dean Miller
Comments Department
Sams Publishing
201 W. 103rd Street
Indianapolis, IN 46290


by Robin Burk and David B. Horvath, CCP

Welcome to UNIX Unleashed, System Administrator's Edition.

Who Should Read This Book

Our highly popular first edition brought comprehensive, up-to-date information on UNIX to a wide audience. That original edition was already 1,600 pages. The new topics covered in this edition have obliged us to split the second edition into two volumes, namely, the System Administrator's Edition and the Internet Edition, which we'll refer to jointly as "the new" or the second edition. Though each volume can stand alone and may be read independently of the other, they form a complementary set with frequent cross-references. This new edition is written for:

  • People new to UNIX

  • Anyone using UNIX who wants to learn more about the system and its utilities

  • Programmers looking for a tutorial and reference guide to C, C++, Perl, awk, and the UNIX shells

  • System administrators concerned about security and performance on their machines

  • Webmasters and Internet server administrators

  • Programmers who want to write Web pages and implement gateways to server databases

  • Anyone who wants to bring his or her UNIX skills and knowledge base up-to-date

A lot has happened in the UNIX world since the first edition of UNIX Unleashed was released in 1994. Perhaps the most important change is the tremendous growth of the Internet and the World Wide Web. Much of the public Internet depends on UNIX-based servers. In addition, many corporations of all sizes have turned to UNIX as the environment for network and data servers. As UNIX fans have long known, the original open operating system is ideal for connecting heterogeneous computers and networks into a seamless whole.

What's New in UNIX Unleashed, Second Edition

This edition of UNIX Unleashed includes a substantial amount of new information describing Internet and World Wide Web technologies in UNIX. New topics include:

  • Programming Web pages with HTML

  • Object-oriented programming in C++

  • Programming Common Gateway Interfaces (CGI) using Perl, C/C++, HTML, and the UNIX shells

  • MIME, the Multipurpose Internet Mail Extension

  • HTTP, the HyperText Transfer Protocol

  • Web servers and server performance

As UNIX becomes the platform of choice for critical network and data applications, UNIX vendors have placed increased emphasis on system maturity, ease-of-use, and security capabilities. Even with the growth of Microsoft Windows NT, UNIX still has a place in the industry. It is more mature, more stable, more scaleable, and has a wider array of applications than NT. Many people claim that NT is the open operating system of the future; that may be true (I have my own personal opinion), but for now, UNIX holds that place.

We've also updated this edition of UNIX Unleashed to bring you current information regarding:

  • Frequently Asked Questions (FAQs) about the most popular variants of UNIX

  • Security issues and the technologies you can use to protect your system and its information against intruders and malicious users

  • The most popular Graphical User Interfaces (GUIs)

As with the original edition, we set out to bring users the most comprehensive, useful, and up-to-date UNIX guide. To meet this goal, we've added nearly two dozen new chapters and have revised much of the original material in the book. The resulting book is so large that it is now divided into two volumes. The System Administrator's Edition introduces UNIX and contains much of the information required for basic users and for systems administrators. The Internet Edition includes advanced information for programmers, Internet/Web developers, and those who need detailed information regarding specific UNIX flavors.

Coverage of Popular UNIX Variants

Based on input from some of the experts, application developers, consultants, and system administrators working in industry, we have provided information about a number of the UNIX variants. We split the variants into two categories: major and minor. This is not a comment on the quality or capabilities of the variant, but on the penetration in the marketplace (popularity).

We consider AIX, HP-UX, Solaris, and SVR4 to be major and BSD, IRIX, Linux, and SunOS to be minor players in the marketplace. There are other variants; the next edition may cover them as they become more popular.

You can identify where something specific to a variant is discussed by the icon next to it:

  • AIX--major--IBM's version that runs on the RS/6000 series of RISC systems and mainframes. Over 500,000 RS/6000 systems have been sold!

  • BSD--minor--This version has a lesser presence in the marketplace. Although many variants can trace their heritage to BSD, it is not that popular as a product.

  • HP-UX--major--Hewlett Packard's (HP) version with a strong hardware presence in the marketplace and a strong future growth path.

  • IRIX--minor--While the Silicon Graphics (SGI) machines are wonderful for graphics, they have not found wide acceptance in business environments.

  • Linux--minor--Although this is a very nice and free variant, it has little commercial presence in the marketplace (probably because corporations do not want to run their mission-critical applications without a vendor they can sue when there is a problem). See the SAMS Linux Unleashed series books (Red Hat and Slackware) for detailed information.

  • Solaris--major--Sun Microsystems' version with a strong hardware presence in the marketplace and a strong future growth path.

  • SunOs--minor--Largely being superseded by Solaris installations. A good variant, but it is difficult for a company to support two versions of UNIX at a time.

  • SVR4--major--This version has a strong presence in the marketplace. In addition, many variants can trace their heritage to System V Release 4.

CD-ROM Contents

We've also enhanced our CD-ROM with a C compiler, the most popular Web server software, and megabytes of other useful tools and information. The CD-ROM packaged with each volume contains exactly the same software and materials. Here are some of the noteworthy inclusions:

  • The entire text of both volumes in HTML format
  • Listings and code examples from various chapters in the volume
  • FreeBSD 2.2.5, full binary release
  • Linux RedHat 4.2, full binary release [x86 platform only]
  • BASH, sources and documentation.
  • sendmail version 8.7
  • RFCs 821, 822, 1425, 1123, 976, 977, 1036
  • latest version of INN source code
  • GNU findutils 4.1
  • GNU fileutils 3.16
  • xv-3.10a
  • disktool (v2.0)
  • tcl/tk
  • screen
  • xarchie
  • xrn
  • Crack (or equivalent)
  • Perl 5.x
  • LaTeX
  • Lynx
  • elm and pine
  • pico
  • UNIX sort utility
  • GNU awk, gawk
  • APACHE web server
  • GNU C compiler
  • emacs editor
  • gtar
  • gzip
  • gcc
  • gmake
  • NCSA Web Server
  • asWedit
  • missinglink
  • Weblint
  • Isearch and Isearch-cgi
  • @cgi.pm
  • LessTif 0.80 sources Linux & FreeBSD bins
  • fvwm window manager
  • Enlightenment window manager
  • libg 2.7.2 (useful companion to C compiler)
  • acroread, Adobe Acrobat PDF reader (for Linux and FreeBSD)

To make use of the CD-ROM easier, whenever a reference in print is made to the CD-ROM, you will see an icon. You can also scan through the text to find the CD-ROM icons to find more information the disk contents.


How These Volumes are Organized

The books are divided into parts (detailed information about each volume is in the next sections). Each volume also contains a glossary of terms and an index.

Whenever there is special information you should pay attention to, it will be placed in a blocks to grab your attention. There are three types of special blocks: note, tip, and caution.

[BEG]NOTE:[END] A note is used to provide you with information that you may want to pay attention to but is not critical. It provides you with information that can be critical but should not cause too much trouble.

[BEG]TIP:[END] A tip is used to make your life easier. It provides you with information so you do not have to go digging for information to solve a problem. These are based on real-life exposure to problems (and how they were solved).

[BEG]CAUTION:[END] A caution is used to grab your attention to prevent you from doing something that would cause problems. Pay close attention to cautions!

The icons shown in the CD-ROM Contents and Coverage of Popular UNIX Variants sections also provide a quick means of referencing information.

How the System Administrator's Edition Is Organized

The first volume, UNIX Unleashed, Systems Administrator Edition, consists of three major sections or parts. The general focus is getting you started using UNIX, working with the shells, and then administering the system.

Part I, Introduction to UNIX, is designed to get you started using UNIX. It provides you with the general information on the organization of the UNIX operating system, how and where to find files, and the commands a general user would want to use. Information is also provided on how to get around the network and communicating with other users on the system.

Part II, UNIX Shells, provides you the information on how to choose which shell to use and how to use that shell. The most popular shells: Bourne, Bourne Again (BASH), Korn, and C, are covered as well as a comparison between them. Under UNIX, the shell is what provides the user interface to the operating system.

Part III, System Administration, gets you started and keeps you going with the tasks required to administer a UNIX system. From installation through performance and tuning, the important topics are covered. The general duties of the system administrator are described (so you can build a job description to give to your boss). In case you are working on a brand-new UNIX system, the basics of UNIX installation are covered. Other topics covered in this section include: starting and stopping UNIX, user administration, file system and disk administration, configuring the kernel (core of the operating system), networking UNIX systems, accounting for system usage, device (add-on hardware) administration, mail administration, news (known as netnews or UseNet) administration, UUCP (UNIX to UNIX Copy Program, an early networking method still in wide use today) administration, FTP (File Transfer Protocol) administration, and finally, backing up and restoring files.

How the Internet Edition Is Organized

The second volume, UNIX Unleashed, Internet Edition, consists of seven major parts. The general focus is programming (GUI, application languages, and the Internet), text formatting (which involves embedding commands in your text and then processing it), security considerations (advanced system administration), developing for the Internet, "programming," getting you started using UNIX, working with the shells, and source code control and configuration management, and Frequently Asked Questions (FAQ) for the different variants of UNIX.

Part I, Graphical User Interfaces, provides you with information about using and writing GUI applications. When the operating system is UNIX, the GUI is the X-windowing system.

Part II, Programming, introduces the most popular program development tools in the UNIX environment. The most important part is how to enter your program (editing with vi and emacs)! The awk, Perl, C, and C++ programming languages are covered. Awk and Perl are interpreted languages designed for quick program development. C is the compiled language developed by Kernighan and Ritchie--UNIX is written in this language. C++ is an enhancement to the C language that supports object oriented programming. The final chapter in this section discusses the make utility, which provides a rule-based method to control program compilation.

Part III, Text Formatting and Printing, covers the tools that support the development, formatting, and printing of documents in the UNIX environment. These tools were much of the original justification for hardware that was used to develop UNIX. The formatting programs, nroff and troff, the standard macro packages, and many of the other document preparation tools are covered. In addition, developing your own text formatting macros is discussed.

Part IV, Security, is an advanced area of systems administration. One of the criticisms of UNIX is that it is not secure. It was developed in an environment where the individuals were trusted and sharing information was important. UNIX is capable of being very secure; you just have to know how to set it up. This section provides that information. The risks, available tools, and helpful organizations are covered.

Part V, UNIX and the Internet, introduces the tools used with the world wide web and the transmission of binary files via email (MIME). The web page definition language, HTML, is introduced, along with the methods of developing CGI (Common Gateway Interface--programs that run on the web server processing data from web pages) programs in shell scripting languages, Perl, and C/C++. Administrative information is provided in chapters on HTTP (HyperText Transport Protocol) and monitoring server activity.

Part VI, Source Control, covers the tools that UNIX provides to maintain control of your source code as different versions (and revisions) are created. The three major tools are RCS, CVS, and SCCS.

Part VII, Frequently Asked Questions, provides answers, as the name implies, to the most frequently asked questions about the various variants of UNIX. AIX, BSD, HP-UX, Linux, Solaris, SVR4, and IRIX are covered in individual chapters.

Conventions Used in This Volume

This book uses the following typographical conventions:

  • Menu names are separated from the individual menu options with a vertical bar (|). For example, "File|Save" means "Select the File menu and then choose the Save option."

  • New terms appear in italic.

  • All code appears in monospace. This includes pseudocode that is used to show a general format rather than a specific example.

  • Words that you are instructed to type appear in monospace bold.

  • Placeholders (words that stand for what you actually type) appear in italic monospace.

  • Lines of code that are too long to fit on only one line of this book are broken at a convenient place and continued on the next line. A code continuation character () precedes the new line. Any code that contains this character should be entered as one long line without a line break.

  • An ellipsis (...) in code indicates that some code has been omitted for the sake of brevity.


©Copyright, Macmillan Computer Publishing. All rights reserved.