Mac OS X Server Command-Line Administration for Version 10.4 Or Later Second Edition
Total Page:16
File Type:pdf, Size:1020Kb
Mac OS X Server Command-Line Administration For Version 10.4 or Later Second Edition K Apple Computer, Inc. Apple, the Apple logo, AppleShare, AppleTalk, Mac, © 2006 Apple Computer, Inc. All rights reserved. Macintosh, QuickTime, Xgrid, and Xserve are trademarks of Apple Computer, Inc., registered in the U.S. and other The owner or authorized user of a valid copy of countries. Finder is a trademark of Apple Computer, Inc. Mac OS X Server software may reproduce this publication for the purpose of learning to use such Adobe and PostScript are trademarks of Adobe Systems software. No part of this publication may be reproduced Incorporated. or transmitted for commercial purposes, such as selling copies of this publication or for providing paid-for UNIX is a registered trademark in the United States and support services. other countries, licensed exclusively through X/Open Company, Ltd. Apache is a registered trademark Every effort has been made to ensure that the of the Apache Software Foundation, and is used with information in this manual is accurate. Apple Computer, permission. Inc., is not responsible for printing or clerical errors. Other company and product names mentioned herein Apple are trademarks of their respective companies. Mention 1 Infinite Loop of third-party products is for informational purposes Cupertino CA 95014-2084 only and constitutes neither an endorsement nor a www.apple.com recommendation. Apple assumes no responsibility with regard to the performance or use of these products. The Apple logo is a trademark of Apple Computer, Inc., registered in the U.S. and other countries. Use of the 019-0635/2-15-2006 “keyboard” Apple logo (Option-Shift-K) for commercial purposes without the prior written consent of Apple may constitute trademark infringement and unfair competition in violation of federal and state laws. 1 Contents Preface 15 About This Guide 16 Using This Guide 16 Understanding Notation Conventions 16 Summary 16 Commands and Other Terminal Text 16 Command Parameters and Options 17 Default Settings 17 Commands Requiring Root Privileges 18 Getting Documentation Updates 18 Getting Additional Information Chapter 1 21 Executing Commands 21 Opening Terminal 22 Specifying Files and Folders 23 Modifying Flow Control 23 Redirecting Input and Output 24 Using Environment Variables 25 Executing Commands and Running Tools 26 Correcting Typing Errors 26 Repeating Commands 26 Including Paths Using Drag and Drop 26 Searching for Text Within a File 26 Commands Requiring Root Privileges 27 Terminating Commands 27 Scheduling Tasks 28 Sending Commands to a Remote Computer 28 Viewing Command Information Chapter 2 31 Connecting to Remote Computers 31 Understanding Secure Shell 31 How SSH Works 32 Password-Less Logins Using SSH Keys 33 Updating SSH Key Fingerprints 3 34 What is an SSH Man-in-the-Middle Attack? 34 Controlling Access to SSH Service 35 Connecting to a Remote Computer 35 Using SSH 36 Using Telnet Chapter 3 37 Installing Server Software and Finishing Basic Setup 37 Installing Server Software 38 Locating Computers for Installation 39 Specifying the Target Computer Volume 39 Preparing the Target Volume for a Clean Installation 40 Installing from Multiple CDs 40 Restarting After Installation 40 Automating Server Setup 41 Creating a Configuration File 43 Working with an Encrypted Configuration File 43 Customizing a Configuration File 47 Storing a Configuration File in an Accessible Location 47 Configuring the Server Remotely from the Command Line 48 Changing Server Settings 48 Using the serversetup Tool 48 Using the serveradmin Tool 49 General and Network Preferences 49 Viewing, Validating, and Setting the Software Serial Number 50 Updating Server Software 51 Moving a Server Chapter 4 53 Restarting or Shutting Down a Computer 53 Restarting a Computer 53 Automatic Restart 54 Changing a Remote Computer’s Startup Disk 54 Shutting Down a Computer 54 Manipulating Open Firmware NVRAM Variables 55 Monitoring and Restarting Critical Services Chapter 5 57 Setting General System Preferences 57 Viewing or Changing the Computer Name 57 Viewing or Changing the Date and Time 58 Viewing or Changing the System Date 58 Viewing or Changing the System Time 58 Viewing or Changing the System Time Zone 58 Viewing or Changing Network Time Server Usage 59 Viewing or Changing the Energy Saver Settings 4 Contents 59 Viewing or Changing Sleep Settings 59 Viewing or Changing Automatic Restart Settings 60 Changing the Power Management Settings 60 Viewing or Changing the Startup Disk Settings 61 Viewing or Changing the Sharing Settings 61 Viewing or Changing Remote Login Settings 61 Viewing or Changing Apple Event Response 61 Viewing or Changing the International Settings 62 Viewing and Changing the Login Settings Chapter 6 63 Setting Network Preferences 63 Configuring Network Interfaces 64 Managing Network Interface Information 64 Viewing Port Names and Hardware Addresses 64 Viewing or Changing MTU Values 65 Viewing or Changing Media Settings 65 Managing Network Port Configurations 65 Creating or Deleting Port Configurations 65 Activating Port Configurations 65 Changing Configuration Precedence 66 Managing TCP/IP Settings 66 Changing a Server’s IP Address 67 Viewing or Changing IP Address, Subnet Mask, or Router Address 69 Viewing or Changing DNS Servers 70 Enabling TCP/IP 70 Working with VLANs 70 IEEE 802.3ad Ethernet Link Aggregation 72 Managing AppleTalk Settings 72 Managing SNMP Settings 73 Installing SNMP 73 Starting SNMP 74 Configuring SNMP 75 Collecting SNMP Information from the Host 76 Managing Proxy Settings 76 Viewing or Changing FTP Proxy Settings 77 Viewing or Changing Web Proxy Settings 77 Viewing or Changing Secure Web Proxy Settings 77 Viewing or Changing Streaming Proxy Settings 77 Viewing or Changing Gopher Proxy Settings 78 Viewing or Changing SOCKS Firewall Proxy Settings 78 Viewing or Changing Proxy Bypass Domains 78 Managing AirPort Settings 79 Managing the Computer, Host, and Bonjour Names Contents 5 79 Computer Name 79 Hostname 80 Bonjour Name 80 Managing Preference Files and the Configuration Daemon 81 Changing Network Locations Chapter 7 83 Working with Disks and Volumes 83 Understanding Disks, Partitions, and the File System 83 Mounting and Unmounting Volumes 84 Mounting Volumes 84 Unmounting Volumes 85 Displaying Disk Information 85 Monitoring Disk Space 86 Reclaiming Disk Space Using Log-Rolling Scripts 87 Erasing, Modifying, Verifying, and Repairing Disks 89 Partitioning and Formatting Disks 89 Partitioning a Disk 90 Labeling a Disk 90 Formatting a Disk 90 Checking for Disk Problems 91 Managing Disk Journaling 91 Checking to See If Journaling is Enabled 91 Enabling Journaling for an Existing Volume 92 Enabling Journaling When You Erase a Disk 92 Disabling Journaling 92 Understanding Spotlight Technology 92 Enabling and Disabling Spotlight 93 Performing Spotlight Searches 94 Controlling Spotlight Indexing 94 Managing RAID Volumes 95 Imaging and Cloning Volumes Using ASR Chapter 8 97 Working with Users and Groups 97 Understanding Accounts 98 Administering and Creating Accounts 98 Creating a Local Administrator User Account for a Server 99 Creating a Domain Administrator User Account 100 Checking a User’s Administrator Privileges 100 Creating a Nonadministrator User Account 103 Retreiving a User’s GUID 103 Removing a User Account 104 Revoking a User’s Right to Access His or Her Account 106 Checking a Server User’s Name, UID, or Password 6 Contents 107 Modifying a User Account 108 Creating a Mobile User Account 109 Managing Home Folders 110 Administering Group Accounts 111 Creating a Group Account 112 Removing a Group Account 113 Adding a User to a Group 114 Removing a User from a Group 116 Creating and Deleting Nested Group 117 Editing Group Records 118 Creating a Group Folder 118 Viewing the Workgroup a User Selects at Login 119 Importing Users and Groups 120 Creating a Character-Delimited User Import File 123 Setting Permissions 123 Viewing Permissions 124 Setting the umask for Individual Users 125 Changing Permissions 126 Changing the Owner 126 Changing the Group 126 Securing System Accounts 126 Securing Initial System Accounts 127 Securing the Root Account 127 Restricting Use of the sudo Tool 128 Securing Single-User Boot 129 Setting Password Policy 131 Finding User Account Information Chapter 9 133 Working with File Services 133 Managing Share Points 134 Listing Share Points 134 Creating a Share Point 135 Modifying a Share Point 136 Disabling a Share Point 136 Managing the AFP Service 136 Starting and Stopping AFP Service 136 Checking AFP Service Status 136 Viewing AFP Settings 137 Changing AFP Settings 137 List of AFP Settings 140 List of AFP serveradmin Commands 141 Listing Connected Users 142 Sending a Message to AFP Users Contents 7 142 Disconnecting AFP Users 143 Canceling a User Disconnect 144 Listing AFP Service Statistics 145 Viewing AFP Log Files 146 Managing the NFS Service 146 Starting and Stopping NFS Service 146 Checking NFS Service Status 146 Viewing NFS Service Settings 146 Changing NFS Service Settings 147 Managing the FTP Service 147 Starting FTP Service 147 Stopping FTP Service 147 Checking FTP Service Status 147 Viewing FTP Service Settings 148 Changing FTP Service Settings 148 List of FTP Service Settings 150 List of FTP serveradmin Commands 150 Viewing the FTP Transfer Log 150 Checking for Connected FTP Users 151 Managing the SMB/CIFS Service 151 Starting and Stopping SMB/CIFS Service 151 Checking SMB/CIFS Service Status 151 Viewing SMB/CIFS Service Settings 152 Changing SMB/CIFS Service