TE AM FL Y UNIX System Administration: A Beginner’s Guide This page intentionally left blank UNIX 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 Copyright © 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 occurrence 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 WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE McGraw-Hill and its licensors 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 circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential 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 whatsoever whether such claim or cause arises in contract, tort or otherwise DOI: 10.1036/0072228334 This page intentionally left blank About 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 For more information about this title, click here Contents ACKNOWLEDGMENTS xvii INTRODUCTION xix Introduction to UNIX Uncover the History of the UNIX System Explore the Elements of a Computer System Show the UNIX Timeline AT&T Invents UNIX BSD Is Born The System V Releases AT&T/Sun Deal The Internet Worm OSF/1 Mach Linux Is Introduced Red Hat Versions of UNIX Today Why UNIX Is Popular Modular UNIX The Kernel Discover the Roles of the UNIX System Administrator Support the Network vii Copyright 2002 by The McGraw-Hill Companies, Inc Click Here for Terms of Use 7 8 9 10 10 10 10 11 15 15 18 19 viii UNIX System Administration: A Beginner’s Guide Handle Peripherals Manage System Upgrades Actively Monitor System Security Maintain System Accounts Advance Your Knowledge Teacher Politician Parent Police Officer Friend Mastery Check 19 20 20 21 21 22 22 23 23 24 25 Basic UNIX Commands Explore the UNIX Shell Investigate Basic UNIX Commands cat date hostname find ls strings ps uname Project 2-1 Mastery Check 27 28 31 34 35 37 38 42 49 52 59 62 63 Using System Administration Tools Managing Solaris Using Admintool Add a New User UNIX Account Example Modifying a User Deleting a User Adding a New Group Modifying a Group Deleting a Group Manage Linux Accounts with Userconf Add a New User Modifying a User Delete an Existing User Adding a New Group Manage HP-UX Using SAM Add a New User Modifying a User Delete an Existing User 65 67 67 72 73 74 76 79 79 80 80 86 88 90 92 94 98 99 Contents Adding a New Group Deleting an Existing Group Set Up Better Account Security Expiring a Password Using Admintool Expiring a Password Using Userconf Expiring a Password Using SAM Regular Password Changes Using Admintool Regular Password Changes Using Userconf Turning Off an Account Using Admintool Turning Off an Account Using Userconf Automatic Account Expiration Using Userconf Mastery Check 101 103 105 106 106 107 109 110 111 113 114 116 Software Package Management Tools Discover Solaris Package Tools pkginfo pkgadd pkgrm Discover HP-UX Package Tools swlist swinstall Project 4-1 swremove Project 4-2 Discover Linux Package Tools Project 4-3 Mastery Check 117 119 119 123 124 126 126 130 130 133 133 136 137 139 Maintaining UNIX Users Discover the /etc/passwd File Discover the /etc/group File Discover the /etc/shadow File Explore UNIX Account Tools passwd pwck grpck useradd userdel usermod groupadd groupdel groupmod logins vipw 141 142 146 149 152 153 156 159 159 161 162 163 164 164 164 166 ix .. .UNIX System Administration: A Beginner’s Guide This page intentionally left blank UNIX System Administration: A Beginner’s Guide Steve Maxwell McGraw-Hill/Osborne New York Chicago San Francisco... 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... 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