Sun Certified System Administrator for Solaris* 2.6 (Part 1) - Cramsession

1. System Concepts

1.1 The Three Parts of an Operating System

The Kernel, the shell and the File System

1.2 The Three Most Common Shells in the Solaris Environment

The three common shells for use as command interpreters are the bourne shell (sh), the C shell (csh) and the Korn shell (ksh). The Bourne shell is the default.

Feature

sh

csh

ksh

Aliases

No

Yes

Yes

Command line editing

No

Yes

Yes

History capability/editing

No

Yes/Yes

Yes/No

History execution

No

!n

r n

Prompt*

$

system name%

$

Repeat last command

No

!!

 

Initialization file - login

.profile

.login

.profile

Initialization file - shell startup

No

.cshrc

user defined

1.3 Distinguishing Factors or Characteristics Between Multitasking and Multiuser

Multitasking: A processor can run more than one task
Multiuser: More than one user can run processes

1.4 The Client-Server Relationship

Two entities (processes or systems) that cooperate to accomplish a task. A client requests a server to obtain access to information or perform some operation. The server provides the information or operation on behalf of the client. This architecture allows information or specific operations to be performed by a single entity on behalf of multiple clients. This simplifies the design of the client and provides data consistency by making a single entity (the server) responsible for the data.

1.5 Definitions for the Following System Terms:

Host, Network, IP Address, Client and Server

2. Installing the Solaris 2.X Software

2.1 Software Configurations, Clusters and Packages

A software package is a functional grouping of files and directories. A cluster is a logical grouping of packages. Solaris 2.X is preconfigured into software groups (collection of clusters and packages). There are four software groups (five for Sparc platforms).

Software Group Group Contents
Core Required operating system files
End user system support Windowing Environments: Common Desktop Environment (CDE), OpenWindows and Motif runtime Libraries
Power Management (energy saving software)
Basic networking/printer support
Standard UNIX and patch utilities
JAVA Virtual Machine

Developer system support

End user group plus:
Development support
CDE/Motif developer software
Online manual pages
Programming tools and libraries
Extended terminal and X support

Entire distribution

Developer system group plus:
Answerbook2
Enhanced security features
UUCP, DCHP and enhanced networking support
Additional language and partial locale
Solstice Launcher

Entire distribution plus OEM support (Sparc only)

Entire distribution group plus:
Voyager drivers and sun4u X server modules
SunFastEthernet
PCI, M64 graphic and Fujitsu device drivers

2.2 Hardware Requirements for Installing the Solaris 2.x Software on a Standalone Workstation

CD-ROM drive for local installation or network interface for network installation. Solarsi 2.6 supports all sun4c and sun4d platforms along with most sun4u and sun4m platforms. A minimum of 16 MB RAM is required (32MB recommended). Depending on selected software group, 281 to 616 MB of disk space is required.

2.3 Preparing an Existing System for a Standalone Installation

To prepare and existing system for installation:

2.4 Installation of the Solaris 2.x Software on a Standalone Workstation Using the Conventional Method Provided by sunInstall

The Solaris Interactive Installation program guides the installer step-by-step but only installs the Solaris software. Co-packaged software must be installed later using the co-packaged installation programs.

2.5 Installation of the Solaris 2.x Software on a Standalone Workstation Using the New Browser Based Installation Procedure Web Start

The Web Start provides a web browser usr interface that allows installation of Solaris and co-packaged software. The default option is to install all software, however only selected software can be installed using a customize option.

3. Booting the Workstation

3.1 Use of the OpenBoot PROM Commands to Record Basic System Configuration Information

Command

Description

banner

Display power-on banner

.enet-addr

Display ethernet address

.idprom

Display formatted ID PROM contents

.speed

Display CPU and bus speeds (OpenBoot 3.x)

.traps

Display a list of SPARC trap types

.version

Display version and date of the boot PROM

devalias

Display all current device aliases

module-info

Display CPU speed (OpenBoot 2.x)

printenv

Display all current NVRAM parameters and default values

probe-scsi

Identify the devices attached to the on-board SCSI controller

probe-scsi-all

Identify the devices attached to the on-board SCSI controller and the devices attached to SBus SCSI controller(s)

show-disks

Display a list of the device paths for installed SCSI disk controllers

show-displays

Display a list of device paths for installed display devices

show-nets

Display a list of device paths for installed ethernet controllers

show-sbus

Display list of installed and probed SBus devices

show-tapes

Display a list of device paths for installed SCSI tape controllers

show-ttys

Display a list of device paths for installed tty devices

3.2 Use of the OpenBoot PROM Commands to Alter the System Boot Device

The default boot device can be changed using by using the setenv boot-device diskn command where n is the disk number, then using the reset command to save the new boot-device value.

3.3 Use of the OpenBoot PROM Commands to Perform Basic Hardware Testing

OpenBoot Command

Purpose

probe-scsi

Test the built-in SCSI bus for connected devices

probe-scsi all

Test all SCSI buses

test-all

Test a group of installed devices

test floppy

Test diskette drive

test /memory

Test memory

test net

Test on-board Ethernet controller

watch-clock

Test system clock

watch-net

Monitor network connection

3.4 Booting a System From More Than One Device

The system can be booted from a different boot device and/or program using boot device file options where device is cdrom, disk, floppy, net or tape; file is the name of the program and options are -a (interactive), -h (halt after loading), -s (single user mode)

During the -a boot, alternate information can be such as physical name of root device, location of kernel, directory for modules, name of file system and type of root filesystem.

4. User Security

4.1 Use of the id Command to Determine Your UID and GID Numbers

The id(1M) command without arguments returns the user and group IDs and corresponding user and group names of the invoking process. If effective and real IDs do no match, both are returned. If invoked with -a as an option, then all groups in which the user ID is a member will be returned. If an user name is provided as an argument, then ID and group information on that user is returned.

4.2 The Superuser Account and its Importance to System Administration

The superuser account, root, can perform changes to the system configuration and override file access controls because it is associated with a UID of 0. Other accounts can gain superuser privileges by being assigned a UID of 0 and in some cases a GID of 0 or using the su(1M) and providing the root password to become root.

4.3 The Purpose of the Sysadmin Group

The sysadmin group (group 14) is used to identify system accounts (logins) that are allowed to perform system administration functions. Programs such as admintool(1M) require that the user be a member of the sysadmin group to add, delete or modify the system configuration.

4.4 Changing of User Ownership for Files and Directories

The chown(1M) command to used to change the ownership of a file or directory. Only the owner of the file or an account with superuser privileges can change the ownership of a file. The chgrp(1M) command to used to change the group permission of a file or directory. Only the owner of the file or an account with superuser privileges can change the group of a file.

4.5 How the who and last Commands Relate to System Security

The last(1) command displays login and logout information about users and terminals. The "last root console" will display all root sessions as well as any user's sessions on the console. The who(1) command displays the accounts currently logged into the system.

4.6 The Format of the /etc/passwd, /etc/shadow, and /etc/group Files and Their Importance to System Security

The /etc/passwd file: user-name : password : uid : gid : comment : home-dir : login-shell

The /etc/shadow file: user-name : password : last-changed : min-password-age : max-password-age : warning : inactive : expire : flag(future)

The /etc/group file: group-name : password : gid : user,user,user

4.7 Modifications to System Default Files to Enable the System Administrator to Control and Monitor Superuser Access to the System

To restrict superuser logins to the console, remove the comment from the CONSOLE line in /etc/default/login.

4.8 Restricting Access to the root Account

Access to the root account is controlled by the associated password.

4.9 How to Monitor the root Account

The /var/adm/loginlog is used to record failed login attempts (root and otherwise). Use of the su(1M) command are logged in /var/adm/sulog (success and failure) while successful attempts are logged in the syslog file.

5. Adding Users and Software With admintool

5.1 Use of admintool to Create a New Group and a New User Account

Create new group: To display Group Window, select Browse then Groups. Select Edit then Add. In the Add Group Window fill in Group Name, Group ID and Member List fields. Click on OK or Apply.

Create new account: To display Users Window, select Browse then Users. Select Edit then Add. In the Add User Window fill in USER IDENTITY fields (User Name, User ID, Primary Group, Secondary Group, Comment and Login Shell), ACCOUNT SECURITY fields (Password cleared until first login, account is locked, no password - setuid only, or normal password), Minimum Changes days, Maximum Change days, Maximum Inactive days, Expiration Date, Warning days) and HOME DIRECTORY fields (check Create Home Dir and enter the full path name in Path). Click OK or Apply.

5.2 Use of the Appropriate Default Environment Files from /etc/skel to Set Up a User Environment

The /etc/skel directory contains three files:

5.3 Changing the password

Passwords can be changed using the passwd(1M) or admintool(1M) command.

5.4 Setting Up Password Aging on an Existing User Account Using admintool

To display Users Window, select Browse then Users. Highlight a user account using the mouse. To display the Modify User Window, select Edit then Modify. Fill in the selected ACCOUNT SECURITY fields (see 5.1). Click OK or Apply.

5.5 Locking a User Account Using admintool

To display Users Window, select Browse then Users. Highlight a user account using the mouse. To display the Modify User Window, select Edit then Modify. Set the ACCOUNT SECURITY Password field to account is locked. Click OK or Apply.

5.6 Deleting a User Account Using Admintool

To display Users Window, select Browse then Users. Highlight a user account using the mouse. Select Edit then Delete. In the Warning Window, click Yes to delete.

5.7 Adding and Removing Software Packages Using the admintool Software Program

Add software package: To display Software Window, select Browse then Software. To display the Add Software Window, select Edit then Add. Highlight software package. Click Add.

Remove software package: To display Software Window, select Browse then Software. Highlight the package to remove using the mouse. Select Edit then Delete. In the Warning Window, click Yes to delete.

6. Software Package Administration Commands

6.1 Display Software Package Information

Information on installed packages is displayed using: pkginfo pkg_name where pkg_name is the name of the package.

6.2 Adding a software package from a CD-ROM

A software package is added from CD-ROM using: pkgadd -d /cdrom/cdrom0 pkg_name

6.3 Removing a Software Package

A software package is removed using: pkgrm pkg_name

6.4 Adding a Software Package From a Spooled Directory

A software package is added from the default spool directory (/var/spool/pkg) using: pkgadd pkg_name. If a different spool directory is used it is specified using the -d argument: pkgadd -d full_path_to_spool_directory pkg_name

7. Maintaining Patches

7.1 Obtaining Current Patch Information and Patches

Patch information along with security patches and other recommended patches can be obtained from Sun via the World Wide Web (http://www.sun.com) or anonymous ftp (sunsolve1.sun.com or sunsite.unc.edu). Or if a service contract is purchased, patches can be obtained from the regulary distributed patch CD-ROM.

7.2 Verification of Current Patches Installed on a System

All patches applied are listed using: showrev -p or patchadd -p

7.3 Installation of Patches

The patchadd(1M) command copies files from the patch directory, determines the Solaris version number of the managing host and the target host, updates the pkginfo file of the patched package with information about the patches that are rendered obsolete by the patch being installed, other patches required by this patch, and patches that are incompatible with this patch. During the installation errors are recorded under /var/sadm/patch/patch-number/log.

7.4 Backing Out Patches

The patchrm command is used to remove a patch. All files modified by the patch are restored unless:

8. Administration of Initialzation Files

8.1 Setting Up a Variable in the .profile File

Shell variables can be setup in the .profile by adding:

     VARIABLE=value; export VARIABLE

where VARIABLE is the name of the variable and value is the initial value.

8.2 Maintaining the /etc/profile File

The /etc/profile is executed before the account .profile. It can be used to set a default TERM type, display the current disk quota, the message of the day and indicate if the user has e-mail.

8.3 Customization of the Templates and Account Initialization Files

The templates under /etc/skel should be customized to reflect the configuration or intended purpose of the system. Likewise, accounts can be customized for a special purpose by modifying the initialization files.

8.4 Customization of initialization files

Any system editor can be used to modify initialization files to customize the user's work environment.

9. File Permissions

9.1 The Display And Change Of Default Permissions (Umask)

The umask is the default permissions used when creating a file. Use: umask to display the default. A three digit octal value (provided as an argument to umask) is used to change the default mask. The digits (left to right) refer owner, group and other. The value of the digits indicate the permissions: read (4), write (2) or execute(1) that should be removed from files. For example, a value of 2 removes write permission. A umask of 022 removes write permission for group and others. File created 777 will be set to 755. Files created 666 become 644.

9.2 Setting Access Control Lists On Files

The setfacl command is used to set the access control lists of files.

9.3 How the setuid and setgid Permissions Relate to System Security

When executed, files with the setuid permission execute with process UID permissions of the owner. When executed, files with the setgid permission execute with process GID permissions of the group.

9.4 Identification of and Setting Up the Sticky Permission

A "t" in the other execute of a file or directory permission indicates the save text mode. For files, this informs the operating system to keep the executable in memory after the process using it has exited. It is designed to minimize start up time associated with frequently used programs.

9.5 How the Sticky Permission Protects Files and Directories

When set on a directory (chmod u+t), only the owner of files or directories under the sticky directory or users with explicit write permissions can delete the files or directories. This allows protection of files and directories under directories that are world writable.

10. Administration and Configuration of CDE

10.1 Configuring the Login Manager

The Login Manager is responsible for displaying the login screen, authenticating users, and starting a user session. The default appearance of the login screen is determined by the contents of the /usr/dt/config/C/Xresources file. To customize the login screen, copy the default Xresources file to /etc/dt/config/C and make the appropriate changes. Behavior (start, stop. etc.) of the Login manager is controled by the dtconfig command.

10.2 Configuring the Session Manager

The Session Manager starts the desktop and restores the environment to (applications, color, fonts, etc.) back to the state when the user last exited. Also these attributes can be configured by modifying the various resources (files that contain enironmental variables and other information). The Session Manager default is usr/dt/config/sys.dtprofile, the system wide settings are under /etc/dt/config/C/sys.resources and the personal settings under home-directory/.dt/sessions/ or home-directory/.dt/display where home-directory is the home directory of the login and display is the name of the dislay.

10.3 Configuring Environment Variables

A set of environmental variables are defined to provide desktop search paths. These are:

For Default System Personal
Applications DTAPPSEARCH DTSPSYSAPPHOSTS DTSPUSERAPPHOSTS
Database DTDATABASESEARCHPATH DTSYSDATABASEHOSTS DTSPUSERDATABASEHOSTS
Icons XMICONSEARCHPATH
XMICONBMSERACHPATH
DTSPSYSICON DTSPUSERICON
Help data DTHELPSEARCHPATH DTSPSYSHELP DTSPUSERHELP

10.4 Modifying the Front Panel

The default Front Panel is defined by the file /usr/dt/appconfig/types/C/dtwm.fp By convention, this default file should never be changed. To make system wide customizations, modify /etc/dt/appconfig/types/C/dtwm.fp. To make personal (per login) customizations, modify home-directory/.dt/types/name.fp where home-directory is the home directory of the login and name is the name choosen for the customization. If the system wide or personal customization files do not exist, create it by copying the default file.

To modify the Front Panel, add or change the PANEL, SUBPANEL, BOX, CONTROL or SWITCH definitions in the appropriate customization file. Then restart the Workspace Manager from the Workspace menu.

10.5 The Concepts of Actions and Data Types

Actions are macros or functions written to automate desktop tasks that can be associated with icons, Front Panel controls or menu items.

Data Types are used to define or describe the attributes associated with data files. For example, it defines what action shoulkd be performed when a file is double-clicked on or is dragged and dropped onto an application icon.

10.6 Adding and Administering Applications with Application Manager

The Application manager provides a graphical interface for associating a icon with an application and creating a hierarchical directory structure for groups of applications.

There are two ways to add an application to Application Manager:

  1. Adding an application by creating a registration package or the application is already packaged as a desktop-smart application.
  2. Adding only an icon for an application

Administration tasks include creating groups, modifying the search path nad removing applications and groups.

10.7 Programming with dtksh

The Desktop Korn Shell (dtksh) provides a way to develop graphical user interfaces through shell scripts. The user interface capabilities are based on the Common Desktop Environment (CDE) Motif widget set, the Xt Intrinsics, and the X11 library. The dtksh is a version of ksh-93 (Korn Shell) extended to access many X, Xt, Motif, and CDE facilities including:

11. Introduction to File Systems

11.1 Defining the Geometry of a Disk

A sector is a grouping of bytes. A track is a grouping of sectors. A cylinder is a grouping of tracks. The number of accessible cylinders on a disk determine its actual storage capacity. This information is stored in the Volume Table of Contents (VTOC) or disk label. For Example:

     512 bytes/sector
     80 sectors/track
     9 tracks/cylinder
     720 sectors/cylinder
     2500 cylinders
     1151 accessible cylinders
     512 * 80 * 9 * 1151 = 424,394,640 bytes or 424 MB

11.2 Displaying Device Configurations

Device configuration information is stored in the Volume Table of Contents (VTOC) or disk label. Information contained in the disk label can be displayed using the devinfo(1M), format(1M) or prtvtoc(1M) command.

11.3 How Slices are Defined on the Disk

Disk slices or partitions are identified by the partition table which is a portion of the disk label. This table defines the partition in terms of number, tag (use), size and starting/ending cylinders. The partition table is populated by the fmthard(1M) command and can be viewed using the format(1M) or prtvoc(1M) commands.

11.4 Definition of the Term File System

A file system is a structure of directories used to organize and store files. The term "file system" is used in several different ways:

11.5 The Contents of Each of the Standard Solaris 2.X File Systems

File System

Contents

/

System files

backup

Backup file system

boot

Information required to boot the system

home

User account storage space

opt

Application software

proc

System process information

swap

Virtual memory

tmp

Temporary files

usr

System files and utilities

var

System files and logs

11.6 Displaying Mounted File Systems

Use df(1)and mount(1M) to display information about mounted file systems.

11.7 Mounting Large File Systems

By default, the mount(1M) command is aware of large files.

11.8 Displaying Disk Space Usage by File Systems

Use df(1) to display the amount of used and available space on each mounted file system.

11.9 Displaying the Size of a Directory

Use du(1) to display the amount space used by a directory and everything under the directory.

11.10 Displaying Disk Usage by User Name

Use quota(1M) to display the amount of space used by a user and the quotas for that user.

12. Disk Management

12.1 The Three Utilities Used to Create, Check and Mount File Systems

The mkfs(1M) or newfs(1M) utility is used to create file systems. For Sparc platforms, only the UFS type of file systems can be created. Before creating a file system on a disk, the disk must be formatted using format(1M) and the Volume Table of Contents (VTOC) must be populated using fmthard(1M). The prtvtoc(1M) utility can be used to display the VTOC. For x86 platforms, the fdisk(1M) is used to create or modify the partition table.

The fsck(1M) utility is used to check and repair file systems. The following types of file systems are supported by fsck(1M) as identified by the -F option:

-F option

File System

Description

cachefs

Cache

In memory cache file system

s5fs

S5

SVR3 file system

ufs

UFS

default SVR4 file system

The mount(1M) utility is used to mount file systems. The following types of file systems are supported by mount(1M) as identified by the -F option:

-F option

File System

Description

cachefs

Cache

Memory based CD-ROM cache

hsfs

High Sierra

CD-ROM file system

nfs

NFS

Network file system

pcfs

PCFS

MS-DOS diskettes

s5fs

S5

x86 file system

tmpfs

Temporary

Memory based system I/O cache

ufs

UFS

Default UNIX (BSD) file system

12.2 The Physical Path Name Differences Between Standard Solaris File Systems and Virtual File Systems

Not a clue.

12.3 Potential Advantages of Any Virtual Disk Management Application

A virtual disk management system can overcome disk capacity limitations, improve performance and reliability by supporting various RAID configurations and enhance manageability by the use of a graphical management tool.

12.4 The Basic Difference Between Solstice Disksuite and Veritas Volume Manager

Solstice Disksuite Volume Manager from Sunsoft is a software disk array subsystem that manages Solaris partitions to improve performance and reliability while addressing some of the disk capacity limitations.

The Veritas Volume Manager is a disk management software subsystem that in addition to addressing performance, reliability and capacity limitations, also provides performance analysis and dynamic on-line tuning to provide optimal use of storage.

12.5 The Main Advantages of Using a Concatenated Virtual File System

Concatenation combines multiple small physical hard disk slices into a single large logical slice that can be used and managed as a single slice.

12.6 The Main Advantage of Using a Striped Virtual File System

Since the data of a striped VFS is spread across the physical hard disk slices in an interlace fashion, this allows increased performance for reads and writes.

13. Script Writing

Note: Only the syntax and capabilities of the Bourne shell are described in this section.

13.1 Traditional Uses of Shell Script Types

Shell scripts can be used to automate maintenance, administrative and text processing tasks.

13.2 Setting and Expanding Shell Variables

A shell varaiable (otherwise known as a keyword parameter) is defined and set using name=value where name is the name of variable and value is contents assigned to the variable (i.e., the variable is set to value), which can be retreived by using the phrase ${name} or if the phrase is unique, simply $name. To avoid problems when a variable is not set, defaults values and actions can be defined and used when the variable is expanded or interpreted:

${name:-value} If name is set and non-null, then use its value; otherwise, use value as default
${name:=value} If name is not set or is null, then use value as its default
${name:?msg} If name is set and non-null, then use its value; otherwise print msg and exit
${name:+value} If name is set and non-null, then replace its value with value

13.3 Positional Parameters as Script Arguments

Positional parameters are used to reference the arguments provided on the command line when the script or function is invoked. Positional parameter $1 refers to the 1st argument, $2 refers to the 2nd arguments, etc. The $0 parameter contains the name of the script or function. The count of postional parameters is contained in $#. The parameters $@ or $* contains all the positional parameters, in order, separated by spaces, starting with $1. The shift command causes the contents of the positional parameters to be shifted. That is, the contents of $1 is discarded, $1 is set to the contents of $2, $2 is set to the contents of $3, etc. The set command can be used to overide the default values of the positional parameters.

13.4 Using Various Quoting Techniques

Single quotes (') are used for literals or to prevent interpretation. Double quotes (") allow interpretation of variables and commands within a phrase. For example, echo '$parameter' will actually echo $parameter while echo "$parameter" will echo the contents of the variable $parameter, or if it is not set, echo nothing.

The grave accents (`) result in command execution. For example echo "Current directory: `pwd`" will cause the pwd command to be executed and the output from it echoed after the Current directory: phrase.

13.5 Use of Redirection and Pipes

Both the input and output of a command can be redirected:

<fubar Use file fubar as standard input
>fubar Use file fubar as standard output (create or truncate)
>>fubar Use file fubar as standard output (create or append)
<>fubar Open file fubar for reading and writing as standard output
<&digit Use open file associated with file descriptor digit as the standard input
&digit Use open file associated with file descriptor digit as the standard output
<&- Close standard input
>&- Close standard output
<<word Here document (see next paragraph)

Here Document: After any parameter or command substitution is performed on word, the shell reads (from standard input) up to the first line that matches word or encounters the end of file (EOF). Optionally, a hyphen (-) can be placed between the << and word, such as <<-word which causes the shell to strip leading tabs off the lines read from standard input. A shell script that uses this method to handle input is referred to as a here document since normally interactive input is accepted from a file instead of a keyboard. For example a file contains the following:

     ed fubar <<!
     1,$s/ABC/CBA/
     w
     q
     !

when executed, this here document will invoke the ed editor on file fubar. In the file, all occurances of ABC will be replaced with CBA. Then the file is save (written) and the editor is exited. Not that the ! is used to delimit the input to the editor. Any character or word can be used as this delimiter, but ! is frequently used.

13.6 The Purpose of and Correct Use of Exit Status

The purpose of an exit status is to imform the caller of a command, if the command succeeded or failed due to an error. Typically commands return zero on success and non-zero on encountering an error. The keyword parameter ${?} contains the exit status of the last executed command. When a shell script exits, the exit status of the last command is returned. However, the exit status can be defined usng the exit n command, which causes the shell to exit with a status of n.

13.7 The if Conditional Statement

if condition ; then list1 ; fi

If condition returns a zero exit status, then execute list1.

if condition ; then list1 ; else list2 ; fi

If condition returns a zero exit status, then execute list1 otherwise execute list2.

if condition ; then list1 ; [ elif conditionx ; then listx ; ] ... [ else list2 ] fi

If condition returns a zero exit status, then execute list1 otherwise, continue with testing the "else if" (elif) conditonals. If a conditionx returns a zero exit status, then execute the associated listx. If none of the conditionals return zero, then execute list2.

13.8 The For Looping Statement

for name do list done
Set the variable name to a postional parameter then execute the commands in list. Start with postional parameter ${1} and repeat for each postional parameter available.

for name in phrase do list done
Set the variable name to a word from phrase then execute the commands in list. Start with the first word in phrase and repeat for each word available. The phrase can be a variable reference such as ${DIGITS} or a literal such as 0 1 2 3 4 5 6 7 8 9. In either situation, spaces or tabs are used to separate the words within phrase.

13.9 The Use of the Case Statement to Control Program Execution Flow

case word in
pattern1 ) list1 ;;
pattern2 ) list2 ;;
...
esac

word is compared against the patterns (pattern1, pattern2, ...). The first pattern that matches will result in the corresponding list to be executed.

13.10 Use of Shell Functions

Shell functions allow repeated portions of script to be written once and called whenever needed. The functions need to be defined before they are called. A function is defined by the following syntax:

name (  )
{
commands
}

Where name is the name of the function and commands is the content of the function.

13.11 Standard Administration Scripts

All of the rc scripts under /etc/init.d are shell scripts along with the system and user profiles.

13.12 Debugging Simple Shell Scripts

When a script is envoked using sh -x or contains set -x the commands and arguments are printed as they are executed. This allows viewing command/parameter substitution and is useful in identifying where errors are encountered.

14. Networks

14.1 Definitions for Internetwork Terms:

Broadcast Bus - The cable media that is used to transmit data between computer systems.

CSMA/CD - Carrier Sense Multiple Access/Collision Detection

Ethernet Interface - The hardware device that interfaces the computer system to the Ethernet broadcast bus

Ethernet Address - Unique 8 digit hexadecimal number that identifies the computer system.

14.2 IP Addressing Classes A, B, and C

Class

Address Range

Leftmost Bits

Network/Host

Max Hosts

A

0 - 127

0

NHHH

16,777,216

B

128 - 191

10

NNHH

65,534

C

192 - 223

110

NNNH

254

D

224 - 239

1110

Multicast

 

E

240 - 255

1111

Experimental

 

14.3 The Function of the Following Files: /etc/inet/hosts, /etc/nodename, and /etc/hostname.xxy

The /etc/inet/hosts (/etc/hosts) file contains the IP addresses and host names of the local system and remote systems. The /etc/nodename file contains the name of the system. The /etc/hostname.hme0 contains either the IP address or hostname of the local system.

14.4 Identifying Users Logged in to the Local Network

The who(1) command can be used to determine who is logged into the local system while the finger(1) command can be used to determine who is logged into the local or a remote system.

14.5 Executing Commands on Another Machine

Commands can be executed remotely using rsh(1) and remsh(1). Or a user can login to the other machine using telnet(1) or rlogin(1) and execute commands locally.

14.6 Copying Files and Directories From One Machine to Another

The ftp(1), rcp(1) and tftp(1) commands can be used to copy files from one machine to another.

14.7 Describing the Function of the /etc/hosts.equiv and .rhosts Files in Relation to Network Security

These files list systems that are trusted and provide remote authenication for activities associated with rlogin(1), rsh(1) and rcp(1). The .rhosts provides a private list of trusted hostname/username combinations.

14.8 Sending ping and spray Requests to a Remote Host to Test Its Response

The ping(1M) command can be used to test operation of the TCP/IP stack while the spray(1M) command will test the TCP/IP stack and also the operation of the Remote Procedure Call (RPC) capability.

14.9 Executing the netstat -i Command and Interpret the Output

The netstat -i command shows the state of the TCP/IP interfaces.

15. The LP Print Service

15.1 Operating Systems Supported by the Solaris Print Service

By using the BSD protocol (RFC 1179), the Solaris Print service support the Solaris 2.X, the SunOS 4.X and 5.X, and the HP-UX operating systems as print clients.

15.2 The Functions of the LP Print Service

The LP Print Service is a set of software utilities that allow users to print files while they continue to work. The Print Service provides the ability to add, define/modify and delete printer definitions, provide print scheduling and supports both local and remote printers.

15.3 Describing What a Print Server and Print Client are

A print server is a system that as a loacl printer attached to it makes makes it available to other systems on the network. A print client is a system that sends its print requests to a print server.

15.4 Defining the Terms Local Printer and Remote Printer

A local printer is a printer attached directly to the local system via a serial or parallel communcation port. A remote printer is a printer attached to another system (or network interface device) that functions as a print server. To access a remote printer from a local system requires defining the local system as a client to the remote printer.

15.5 Local and Remote Print Models

/etc/lp/model/standard is the default model for local printers
/etc/lp/model/netstandard is the default model for remote printers.

15.6 Verifying That a Printer Type Exists in the Terminfo Database

The infocmp(1M) command can be used to display a terminfo entry for a printer, if its terminfo name is known. Another method is to change to the /usr/share/lib/terminfo directory and search the subdirectories for an appropriate name.

15.7 Using Admintool to Add a Local and Remote Printer to a System

Add local printer: To display the Printers Windows, select Browse then Printers. To display the Add Local Printer Window, select Edit, then Add then Local Printer ... Fill in Printer name, Description, Printer Port (ports such as /dev/term/a), Printer Type (postscript, HP, etc.), File Contents (PostScript, ASCII, both, none, any), Fault Notification (write superuser, mail superuser,none), Options (default printer, always print banner), and User Access List (default of all - use Add or Delete buttons to modify). Click on OK.

Add remote printer (add printer access on the print client): To display the Printers Windows, select Browse then Printers. To display the Add Access to Printer Window, select Edit, then Add then Access to Printer ... Fill in Printer Name, Print Server, Description, and Option (default printer). Click on OK.

15.8 Modifying a Printer's Configuration Using Admintool

To display the Printers Windows, select Browse then Printers. To display the Modify Window, select Edit, then Modify ... Modify Description, Printer Port (ports such as /dev/term/a), File Contents: (PostScript, ASCII, both, none, any), Fault Notification (write superuser, mail superuser,none), Options (default printer, always print banner, accept print requests, process print requests), or User Access List (use Add or Delete buttons to modify). The Printer Name, Print Server and Printer Type cannot be modified. After making changes, click on OK.

16. Print Commands

16.1 Use of the lp Command to Print Files

Use lp file to submit file to the default printer. Or add -d printer to specify a different printer.

16.2 Use of the lpstat Command to Monitor Print Jobs

Use lpstat to check the status of print requests.

16.3 Use of the cancel Command to Cancel Print Jobs

Use cancel request-ID to cancel print job request-ID. The print request ID is displayed when the print request is submitted or can be determined using lpstat. or use cancel printer to cancel the print job currently printing on printer.

16.4 Use of lpadmin to Set Up a Printer Class

Use lpadmin -p printer -c class where class is the printer class and printer is a printer to be added to the class. This allows users to specify a printer class instead of a printer, The first available printer in the class is will be used. Use lpadmin -r class to delete the class.

16.5 Manually Designating a Default Printer Destination Using the lpadmin Command or Environmental Variable

Use lpadmin -d printer to designate printer as the default printer or set the LPDEST variable to printer

16.6 Use the lpmove Command to Move a Queued Print Request From One Printer to Another

Use lpmove printer1 printer2 to move all queued prints requests from printer1 to printer2.

16.7 Assigning Priorities to Print Requests and Moving a Job to the Top of the Queue

Use lp -I request-ID -H priority-tag where request-ID is the request ID of the print request and priority-tag is -hold, -resume or -immediate or use lp -I request-ID -q priority where priority is a number between 0 and 39 (inclusive). Use a priority of zero to move the job to the top of the queue. (The print request ID is displayed when the print request is submitted or can be determined using lpstat).

16.8 Stopping and Starting the LP Print Service

Use /usr/lib/lp/lpsched to start the LP Print Service and /usr/lib/lp/lpshut to stop the service.

17. Process Control

17.1 Use of the ps Command to List Processes Running on the System

     ps -efl

Among the arguments supported are e (all processes), f (full listing) and l long listing.

17.2 Use of the kill Command to Terminate Processes Running on the System

     kill -s signal pid ...

17.3 Use of the at Command to Execute a Command at a Future Date

     at -f file -t time

17.4 The Function of the cron Daemon

The cron daemon executes commands at specified dates and times in accordance with the instructions in the appropriate crontab files.

17.5 The Format of the crontab File

     minute hour day_of_month month day_of_week command

     (0 is sunday)

17.6 The Two Files Used to Control crontab Access

The two files are /etc/cron.d/cron.allow and /etc/cron.d/cron.deny.

17.7 Editing the User's crontab File to Schedule Nightly Backups of the User's Home Directory

18. Backup and recovery

18.1 Dumping a File System to Tape Using the ufsdump Utility

     ufsdump oucf /dev/rmt/n filesystem

18.2 Restoring Files Or A File System From Tape Using the ufsrestore Utility

     ufsrestore tf /dev/rmt/n

18.3 Recovering The root Or /usr File System

To restore the root (/) file system on a SPARC system:

# mount /dev/dsk/c0t3d0s0 /mnt (mount new system disk on temporary mount point)
# cd /mnt
# tapes
# ufsrestore rvf /dev/rmt/0 (restore root to new system disk)
# ls
# rm restoresymtable
# cd /
# umount /mnt
# fsck /dev/rdsk/c0t3d0s0
# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t3d0s0 (install boot blocks)
# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t3d0s0
# init 6

To restore the root (/) file system on an x86 system:

# mount /dev/dsk/c0t3d0s0 /mnt
# cd /mnt
# tapes
# ufsrestore rvf /dev/rmt/0
# ls
# rm restoresymtable
# cd /
# umount /mnt
# fsck /dev/rdsk/c0t3d0s0
# installboot /usr/platform/`uname -i`/lib/fs/ufs/pboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t3d0s0
# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t3d0s0
# init 6

For /usr, use the same procedure except do not install the boot block and use the /usr backup tape instead.

18.4 Back Up And Restoring A Directory Using the tar Utility

     Backup: tar cvf /dev/rmt/n directory
     Restore: tar xvf /dev/rmt/n directory

18.5 Positioning A Tape To A Selected Data Set Using mt Utility

     mt -f /dev/rmt/n fsf count
     (skip forward over count EOF marks. Use bsf to skip backwards)

18.6 Back Up And Restoring A Directory Contents Using the cpio Utility

     Backup: ls | cpio -oc > /dev/rmt/n obs=blocksize
     Restore: cpio -icvd < /dev/rmt/n

18.7 Back Up And Restoring Files To A Remote Tape Unit Using the dd Utility

     Backup: tar cf - files | rsh remotehost dd of=/dev/rmt/n obs=blocksize
     Restore: rsh remotehost dd if=/dev/rmt/n | tar xvBpf -

19. Device Administration

19.1 Defining The Following Terms:

Serial Device - a device that have been designed according to RS-232-C or RS-423 standards (this includes most modems, alphanumeric terminals, plotters, and some printers) that can be plugged into serial ports of computers that have been similarly designed.

Port - a channel through which a device communicates with the operating system. From a hardware perspective, a port is a "receptacle" into which a terminal or modem cable may be plugged. However, a port is not strictly a physical receptacle, but an entity with hardware (pins and connectors) and software (a device driver) components. A single physical receptacle often provides multiple ports, allowing connection of two or more devices.

Serial Port - a port that uses a standard communications protocol to transmit information over a communication line one binary bit at a time.

Modem - a communication device that interfaces a computer/terminal to a phone line and converts digital computer data to analog signals for transmission across the phone line.

Null Modem Cable - a cable that can be used instead of a pair of modems and phone line for short-distance communication.

Hardware Carrier Detect - a communication standard protocol signal that indicates that the carrier signal from the remote end has been detected.

Port Monitor Program - a program that continuously monitors a port for requests to log in or access printers or files.

19.2 Naming At Least Two Serial Devices

Modems, alphanumeric terminals, plotters, and some printers are serial devices.

19.3 Identifying The Two Serial Ports Located On The Back Of The CPU Board

19.4 Describing the Three Types of Modem Access

19.5 Giving An Example Of A Data Communication Equipment Device And A Data Terminal Equipment Device

20. The Service Access Facility

20.1 The Top-Level Service Access Facility Process And Its Function

The top level SAF process is the Service Access Controller (SAC). It initializes its environment and starts the port monitors as specified in /etc/saf/_sactab file.

20.2 The Run Level Where SAC Is Started

The SAC is spawned by init at run level 2.

20.3 The Two Port Monitor Types Available Under SAF And Describe Each

The ttymon port monitor handles connections requests via serial communication ports. The listen port monitor handles connection-oriented TLI compatible requests.

20.4 The Configuration File That Tells sac Which Port Monitors To Initialize

The /etc/saf/_sactab

20.5 Defining The Term Service

The monitoring and setup of a connection via a communication port.

20.6 The File Used By The ttymon Port Monitor To Initialize The Speed And Terminal Settings For Each Port

The /etc/ttydefs file

20.7 The Function Of The sacadm, pmadm, And ttyadm Commands

sacadm is used to start, stop, enable, disable, add or remove port monitors. pmadm is used to start, stop, enable, disable, add or remove services for particular communication ports. ttyadm is used to format and fill in information for the /etc/saf/pmtag/_pmtag table.

21. Adding Terminals and Modems

21.1 Adding a Terminal To a System Using Admintool

To display the Serial Ports window, select Browse then Serial Ports. Highlight the port to be used. To display the Modify Serial Port Window, select Edit, then Modify. Choose Terminal-Hardwared from the User Template menu, change other settings as required, then click on OK to configure the port.

21.2 Adding a Bidirectional Modem Using Admintool

To display the Serial Ports window, select Browse then Serial Ports. Highlight the port to be used. To display the Modify Serial Port Window, select Edit, then Modify. Choose Modem-Bidirectional from the User Template menu, change other settings as required, then click on OK to configure the port.

21.3 The Syntax and Purpose of the tip Command

The tip command is used to connect to a remote system via a modem and phone line. A set of tilde commands are available to support transfer of files and communication with the remote system. The syntax of the tip command is:

     tip [ -v ] [ -speed-entry ] { hostname | phone-number | device }

where speed-entry is the baud rate that should be used for the connection and the remote system is referenced by a hostname, phone-number to dial, or a dedicated device that provides a communication connection to the remote host.

21.4 The File that the tip Command References to Identify Remote System and Line Speeds

The /etc/remote file contains descriptions regarding remote systems using a structure similar to the termcap file. This includes default device and phone numbers, and various communication capabilities such as parity, duplex mode and flow control. The phone number field (pn) may refer to an entry in the /etc/phones which contains the remote host phone number database.

22. Adding Terminals and Modems from the Commmand Line

22.1 Setting Up a Terminal From the Command Line Using SAF

Use sacadm -l to determine if a ttymon port monitor is active. If not or a separate port monitor is desired, start a ttymon port monitor (with appropriate arguments): sacadm -a -p tag -t ttymon -c /usr/lib/saf/ttymon -v `ttyadm -V` Then start up a service for the port to which the terminal will be attached: pmadm -a -p tag -s service_tag -i owner -fu -v `ttyadm -V` -m "`ttyadm -T terminal_type -d /dev/term/port -l ttydef_entry -m ldterm,ttcompat -s /usr/bin/login`"

22.2 Setting Up a Bidirectional Modem From the Command Line Using SAF

Note that the difference between setting up a terminal (as in 22.1) and a bidirectional modem is the
-b argument to ttyadm.

Use sacadm -l to determine if a ttymon port monitor is active. If not or a separate port monitor is desired, start a ttymon port monitor (with appropriate arguments): sacadm -a -p tag -t ttymon -c /usr/lib/saf/ttymon -v `ttyadm -V` Then start up a service for the port to which the modem will be attached using pmadm -a -p tag -s service_tag -i owner -fu -v `ttyadm -V` -m "`ttyadm -b -T terminal_type -d /dev/term/port -l ttydef_entry -m ldterm,ttcompat -s /usr/bin/login`"

 
Special Thanks to Darrell Ambro for writing this Cramsession.
Make sure to check out his extensive Solaris study guide at: http://ns.netmcr.com/~ambro/intro.htm

*Trademark of Sun Microsystems, Inc.