McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION TH
Trang 1TE AM
Trang 2UNIX System Administration:
A Beginner’s Guide
Trang 3This page intentionally left blank.
Trang 4UNIX System Administration:
A Beginner’s Guide
Steve Maxwell
McGraw-Hill/Osborne
New York Chicago San Francisco
Lisbon London Madrid Mexico City
Milan New Delhi San Juan
Seoul Singapore Sydney Toronto
Trang 5Copyright © 2002 by The McGraw-Hill Companies, Inc All rights reserved Manufactured in the United States of America Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher
0-07-222833-4
The material in this eBook also appears in the print version of this title: 0-07-219486-3
All trademarks are trademarks of their respective owners Rather than put a trademark symbol after every occur-rence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark Where such designations appear in this book, they have been printed with initial caps
McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs For more information, please contact George Hoare, Special Sales, at george_hoare@mcgraw-hill.com or (212) 904-4069
TERMS OF USE
This is a copyrighted work and The McGraw-Hill Companies, Inc (“McGraw-Hill”) and its licensors reserve all rights in and to the work Use of this work is subject to these terms Except as permitted under the Copyright Act
of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish
or sublicense the work or any part of it without McGraw-Hill’s prior consent You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited Your right to use the work may be terminated if you fail to comply with these terms
THE WORK IS PROVIDED “AS IS” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES
OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WAR-RANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom McGraw-Hill has no responsibility for the content of any information accessed through the work Under no cir-cumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, conse-quential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages This limitation of liability shall apply to any claim or cause whatso-ever whether such claim or cause arises in contract, tort or otherwise
DOI: 10.1036/0072228334
Trang 6This page intentionally left blank.
Trang 7About the Author
Steve Maxwell has been actively involved with UNIX and computer networking for the last 20 years He has worked for a number of companies, institutions, and organizations in a variety of capacities that have included network design, software development, and training Recently, Steve decided that it was time
to join another start-up company, and he now works at FineGround Networks, Inc., where he is responsible for ensuring that the company delivers quality software products Steve welcomes your feedback on any aspect of this book—
please send comments, questions, and suggestions to sjmaxwell@worldnet.att.net.
About the Technical Reviewers
John Tiso is a senior consultant for NIS, a Boston-based integrator of Sun Microsystems and Cisco Systems He has a B.S degree from Adelphi University and is certified in UNIX from HP, Sun, and IBM John is also a Cisco CCIE (CCIE #5162), MCSE, and MCNE He has published papers in several leading
technical journals, such as Element K and SysAdmin, and has served as a technical editor for a variety of books John can be reached at johnt@jtiso.com.
Jim Minatel is a freelance writer and editor with more than 13 years of publishing experience in mathematics, statistics, and computing He has authored and co-authored several books about the Internet and World Wide Web in the early Netscape era, and most recently served as Editor in Chief for two magazines for networking professionals and IT managers He holds undergraduate degrees in mathematics and physics, and an M.S in mathematics
Trang 8ACKNOWLEDGMENTS xvii
INTRODUCTION xix
1 Introduction to UNIX 1
1 Uncover the History of the UNIX System 2
2 Explore the Elements of a Computer System 3
3 Show the UNIX Timeline 7
AT&T Invents UNIX 7
BSD Is Born 8
The System V Releases 8
AT&T/Sun Deal 9
The Internet Worm 9
OSF/1 9
Mach 10
Linux Is Introduced 10
Red Hat 10
Versions of UNIX Today 10
Why UNIX Is Popular 11
Modular UNIX 15
The Kernel 15
4 Discover the Roles of the UNIX System Administrator 18
Support the Network 19
vii
For more information about this title, click here.
Copyright 2002 by The McGraw-Hill Companies, Inc Click Here for Terms of Use
Trang 9viii UNIX System Administration: A Beginner’s Guide
Handle Peripherals 19
Manage System Upgrades 20
Actively Monitor System Security 20
Maintain System Accounts 21
Advance Your Knowledge 21
Teacher 22
Politician 22
Parent 23
Police Officer 23
Friend 24
Mastery Check 25
2 Basic UNIX Commands 27
1 Explore the UNIX Shell 28
2 Investigate Basic UNIX Commands 31
cat 34
date 35
hostname 37
find 38
ls 42
strings 49
ps 52
uname 59
Project 2-1 62
Mastery Check 63
3 Using System Administration Tools 65
1 Managing Solaris Using Admintool 67
Add a New User 67
UNIX Account Example 72
Modifying a User 73
Deleting a User 74
Adding a New Group 76
Modifying a Group 79
Deleting a Group 79
2 Manage Linux Accounts with Userconf . 80
Add a New User 80
Modifying a User 86
Delete an Existing User 88
Adding a New Group 90
3 Manage HP-UX Using SAM 92
Add a New User 94
Modifying a User 98
Delete an Existing User 99
Trang 10Contents ix
Adding a New Group 101
Deleting an Existing Group 103
4 Set Up Better Account Security 105
Expiring a Password Using Admintool 106
Expiring a Password Using Userconf 106
Expiring a Password Using SAM 107
Regular Password Changes Using Admintool 109
Regular Password Changes Using Userconf 110
Turning Off an Account Using Admintool 111
Turning Off an Account Using Userconf 113
Automatic Account Expiration Using Userconf 114
Mastery Check 116
4 Software Package Management Tools 117
1 Discover Solaris Package Tools 119
pkginfo 119
pkgadd 123
pkgrm 124
2 Discover HP-UX Package Tools 126
swlist 126
swinstall 130
Project 4-1 130
swremove 133
Project 4-2 133
3 Discover Linux Package Tools 136
Project 4-3 137
Mastery Check 139
5 Maintaining UNIX Users 141
1 Discover the /etc/passwd File 142
2 Discover the /etc/group File 146
3 Discover the /etc/shadow File 149
4 Explore UNIX Account Tools 152
passwd 153
pwck 156
grpck 159
useradd 159
userdel 161
usermod 162
groupadd 163
groupdel 164
groupmod 164
logins 164
vipw 166