1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Unix and linux system administration handbook

10 1 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 511,26 KB

Nội dung

UNIX AND LINUX SYSTEM ® ® ADMINISTRATION HANDBOOK FOURTH EDITION This page intentionally left blank UNIX AND LINUX SYSTEM ® ® ADMINISTRATION HANDBOOK FOURTH EDITION Evi Nemeth Garth Snyder Trent R Hein Ben Whaley with Terry Morreale, Ned McClain, Ron Jachim, David Schweikert, and Tobi Oetiker 6QQFS4BEEMF3JWFS /+t#PTUPOt*OEJBOBQPMJTt4BO'SBODJTDP /FX:PSLt5PSPOUPt.POUSFBMt-POEPOt.VOJDIt1BSJTt.BESJE $BQFUPXOt4ZEOFZt5PLZPt4JOHBQPSFt.FYJDP$JUZ Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals Red Hat Enterprise Linux and the Red Hat SHADOWMAN logo are registered trademarks of Red Hat Inc., and such trademarks are used with permission Ubuntu is a registered trademark of Canonical Limited, and is used with permission SUSE and openSUSE are registered trademarks of Novell Inc in the United States and other countries Oracle Solaris and OpenSolaris are registered trademarks of Oracle and/or its affiliates All rights reserved HP-UX is a registered trademark of Hewlett-Packard Company (HP-UX®) AIX is a trademark of IBM Corp., registered in the U.S and other countries The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests For more information, please contact: U.S Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the United States, please contact International Sales (international@pearson.com) Visit us on the Web: informit.com/ph Library of Congress Cataloging-in-Publication Data UNIX and Linux system administration handbook / Evi Nemeth [et al.] —4th ed p cm Rev ed of: Unix system administration handbook, 3rd ed., 2001 Includes index ISBN 978-0-13-148005-6 (pbk : alk paper) Operating systems (Computers) UNIX (Computer file) Linux I Nemeth, Evi II Unix system administration handbook QA76.76.O63N45 2010 005.4'32—dc22 2010018773 Copyright © 2011 Pearson Education, Inc All rights reserved Printed in the United States of America This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise For information regarding permissions, write to: Pearson Education, Inc Rights and Contracts Department 501 Boylston Street, Suite 900 Boston, MA 02116 Fax: (617) 671-3447 ISBN-13: 978-0-13-148005-6 ISBN-10: 0-13-148005-7 Text printed in the United States on recycled paper at Edwards Brothers in Ann Arbor, Michigan First printing, June 2010 Table of Contents FOREWORD PREFACE ACKNOWLEDGMENTS xlii xliv xlvi SECTION ONE: BASIC ADMINISTRATION CHAPTER WHERE TO START Essential duties of the system administrator Account provisioning Adding and removing hardware Performing backups Installing and upgrading software Monitoring the system Troubleshooting Maintaining local documentation Vigilantly monitoring security Fire fighting Suggested background Friction between UNIX and Linux Linux distributions Example systems used in this book 10 Example Linux distributions 11 Example UNIX distributions 12 v vi UNIX and Linux System Administration Handbook System-specific administration tools 13 Notation and typographical conventions 13 Units 14 Man pages and other on-line documentation 16 Organization of the man pages 16 man: read man pages 17 Storage of man pages 17 GNU Texinfo 18 Other authoritative documentation 18 System-specific guides 18 Package-specific documentation 19 Books 19 RFCs and other Internet documents 20 The Linux Documentation Project 20 Other sources of information 20 Ways to find and install software 21 Determining whether software has already been installed 22 Adding new software 23 Building software from source code 25 System administration under duress 26 Recommended reading 27 System administration 27 Essential tools 27 Exercises 28 CHAPTER SCRIPTING AND THE SHELL 29 Shell basics 30 Command editing 30 Pipes and redirection 31 Variables and quoting 32 Common filter commands 33 cut: separate lines into fields 34 sort: sort lines 34 uniq: print unique lines 35 wc: count lines, words, and characters 35 tee: copy input to two places 35 head and tail: read the beginning or end of a file 36 grep: search text 36 Table of Contents vii bash scripting 37 From commands to scripts 38 Input and output 40 Command-line arguments and functions 40 Variable scope 42 Control flow 43 Loops 45 Arrays and arithmetic 47 Regular expressions 48 The matching process 49 Literal characters 49 Special characters 50 Example regular expressions 51 Captures 52 Greediness, laziness, and catastrophic backtracking 53 Perl programming 54 Variables and arrays 55 Array and string literals 56 Function calls 56 Type conversions in expressions 57 String expansions and disambiguation of variable references 57 Hashes 57 References and autovivification 59 Regular expressions in Perl 60 Input and output 61 Control flow 61 Accepting and validating input 63 Perl as a filter 64 Add-on modules for Perl 65 Python scripting 66 Python quick start 67 Objects, strings, numbers, lists, dictionaries, tuples, and files 69 Input validation example 70 Loops 71 Scripting best practices 73 Recommended reading 74 Shell basics and bash scripting 74 Regular expressions 75 Perl scripting 75 Python scripting 75 Exercises 76 viii UNIX and Linux System Administration Handbook CHAPTER BOOTING AND SHUTTING DOWN 77 Bootstrapping 78 Recovery boot to a shell 78 Steps in the boot process 78 Kernel initialization 79 Hardware configuration 79 Creation of kernel processes 79 Operator intervention (recovery mode only) 80 Execution of startup scripts 81 Boot process completion 81 Booting PCs 82 GRUB: The GRand Unified Boot loader 83 Kernel options 84 Multibooting 85 Booting to single-user mode 86 Single-user mode with GRUB 86 Single-user mode on SPARC 86 HP-UX single-user mode 87 AIX single-user mode 87 Working with startup scripts 87 init and its run levels 88 Overview of startup scripts 89 Red Hat startup scripts 91 SUSE startup scripts 93 Ubuntu startup scripts and the Upstart daemon 94 HP-UX startup scripts 95 AIX startup 95 Booting Solaris 97 The Solaris Service Management Facility 97 A brave new world: booting with SMF 99 Rebooting and shutting down 100 shutdown: the genteel way to halt the system 100 halt and reboot: simpler ways to shut down 101 Exercises 102 CHAPTER ACCESS CONTROL AND ROOTLY POWERS 103 Traditional UNIX access control 104 Filesystem access control 104 Process ownership 105 The root account 105 Setuid and setgid execution 106 Table of Contents ix Modern access control 106 Role-based access control 108 SELinux: security-enhanced Linux 109 POSIX capabilities (Linux) 109 PAM: Pluggable Authentication Modules 109 Kerberos: third-party cryptographic authentication 110 Access control lists 110 Real-world access control 110 Choosing a root password 111 Logging in to the root account 112 su: substitute user identity 113 sudo: limited su 113 Password vaults and password escrow 117 Pseudo-users other than root 118 Exercises 119 CHAPTER CONTROLLING PROCESSES 120 Components of a process 120 PID: process ID number 121 PPID: parent PID 121 UID and EUID: real and effective user ID 122 GID and EGID: real and effective group ID 122 Niceness 123 Control terminal 123 The life cycle of a process 123 Signals 124 kill: send signals 127 Process states 128 nice and renice: influence scheduling priority 129 ps: monitor processes 130 Dynamic monitoring with top, prstat, and topas 133 The /proc filesystem 135 strace, truss, and tusc: trace signals and system calls 136 Runaway processes 138 Recommended reading 139 Exercises 139 CHAPTER THE FILESYSTEM 140 Pathnames 142 Absolute and relative paths 142 Spaces in filenames 142 Filesystem mounting and unmounting 143 The organization of the file tree 145 .. .UNIX AND LINUX SYSTEM ® ® ADMINISTRATION HANDBOOK FOURTH EDITION This page intentionally left blank UNIX AND LINUX SYSTEM ® ® ADMINISTRATION HANDBOOK FOURTH EDITION Evi... Congress Cataloging-in-Publication Data UNIX and Linux system administration handbook / Evi Nemeth [et al.] —4th ed p cm Rev ed of: Unix system administration handbook, 3rd ed., 2001 Includes index... Example Linux distributions 11 Example UNIX distributions 12 v vi UNIX and Linux System Administration Handbook System- specific

Ngày đăng: 20/10/2022, 10:44