Beruflich Dokumente
Kultur Dokumente
by
FRANK D. MOORE
March 1995
Table of Contents
1. What things do you need to know and study
2. What file systems must UNIX have at a minimum to be able to run
3. What are the Unix file systems
4. Where are orphaned files and directories found
5. What are the different directories for
6. Use of efficient path variables
7. Uses of metacharacters
8. Shutdown a system
9. Reboot/Start the system
10. View your current run level
11. Change run levels
12. Add and remove a package
13. How to store packages
14. How to display installed packages
15. Check installed packages
16. Check spooled packages
17. How to use pkgtrans
18. Set the date, time, and timezone
19. Display the date and time
20. Display the system name and the version number
21. Set the system name and the node name
22. Display the network name
23. Display configuration information
24. Display the system’s configuration
25. List free processors
26. Check processors
27. Set the processors online and offline
28. Display classes currently configured in the system
29. Display who is on the system
30. How to determine who is using a specific file system
31. List files by age
32. Do a recursive list of a directory and it’s subdirectories and files
33. See true file attributes and true file names
34. Hide a file
35. Make a file unreadable
36. Identify large space users
37. Identify large files
38. Identify and remove inactive files
39. Identify large directories
40. Shrink large directories
41. How to move a directory across a file system
42. Display disk usage
43. Display disk free space
44. Monitor files and directories that grow
45. Monitor and control disk space usage
46. Create new kernels
47. Load and boot new kernels
48. Check the dump area
49. Check where a dump is
50. Do the memory dump procedure
51. Save a dump to media
52. Save a dump to a file
53. Add dump area
54. Remove dump area
55. Check the swap space
56. Add swap space
57. Remove swap space
58. Add a swap file
59. Remove a swap file
60. Mount and Exit the maintenance file system
61. Check a file system from the maintenance file system
62. Mount and unmount a file system
63. Display mounted file systems
64. Display and check file system defaults
65. Create an s5, ufs, bfs, nfs, vxfs file system
66. See a list of file system types installed in the kernel
67. Repair the root file system
68. Restore corrupted root file systems
69. Repair a nonroot file system
70. Eliminate file system fragmentation
71. Setup an automatic file system check
72. What are init, inittab, cron, crontab, crontabs, mount, vfstab, and mnttab
73. How does init and inittab work
74. How to use /etc/mnttab
75. How to use /etc/vfstab
76. If vfstab is wrong and you want to check a file system type
77. How does cron, crontab, crontabs, and the at command work
78. How to schedule tasks
79. Schedule a backup
80. Change, display, and delete scheduled backups
81. Erase contents of storage devices
82. List reserved devices
83. Rewind and retension a tape
84. Copy to a tape drive
85. Copy to a flex diskette
86. Restore from a tape drive
87. Restore from a flex diskette
88. Parition a disk
89. Change the active partition
90. Slice a disk
91. Display disk slicing
92. Perform a selective backup of files and directories
93. Restore individual files, directories, file systems, and slices
94. Backup a file system/slice
95. Backup a raw device
96. Restore a raw device
97. Backup a Unix disk
98. Restore a Unix disk
99. Backup an entire system
100. Restore an entire system
101. How to make a device node
102. Replace a corrupted device file
103. Compact files in /stand
104. Recover the root password
105. Recover /etc/password
106. Recover /etc/shadow
107. Recover sector zero
108. Recover the boot loader
109. Set up an alternate superblock
110. Recover files in /stand
111. Recover unix in /stand
112. Recover from an install tape
113. Format fixed or removable devices
114. Mark bad blocks
115. Manage/Display bad blocks
116. Add a disk
117. Create a UNIX disk
118. Write boot code and initialize disks
119. Setup an alternate boot disk
120. Booting from the alternate boot disk
121. Telnet to a site
122. FTP to a site
123. Free a port
124. Get a port
125. Cu to a system
126. Use of rlogin
127. Start and stop TCPIP
128. Install TCPIP
129. TCPIP Information
130. Use of symbolic links
131. how to do a data capture
132. How to use the script command
133. How to use the didle and strace commands
134. How to use the spray command
135. Setup profile and .profile
136. Set system passwords
137. List users
138. List groups
139. List users, groups, and system login information
140. Add, modify, and delete users
141. Add, modify, and delete groups
142. Display password information
143. Assign or modify a password
144. Define defaults for adding users
145. Maintain shadow and password files
146. Control password aging
147. List information about port monitors and services
148. Configure a port monitor
149. Add a port monitor
150. Remove a port monitor
151. Modify(start, stop, enable, disable, display) a port monitor
152. Configure a service
153. Add a service
154. Remove a service
155. Modify(enable, disable) a service
156. Add a service to one or all port monitors
157. Setup/Add serial port for a terminal
158. Remove a serial port's terminal
159. How to use stty
160. Configure a serial port for a modem
161. Start and stop the lp print service
162. Move print requests to a different printer
163. Cancel a print job without disabling the printer
164. Send a print request
165. Display status of the lp print service
166. Add a new printer destination
167. Modify a printer/printer destinations
168. Remove a printer
169. Accept a printer
170. Reject requests to a printer
171. Enable a printer
172. Disable a printer
173. Specify printer port characteristics
174. How to setup and use UUCP
1. What things do you need to know and study:
1.What are some of the important UNIX files and daemons (textbooks, workbooks)
2. Writing shell scripts (shell programming textbook)
3. I/O balancing (Ch. 22 CLI)
4. Buffer utilization (Ch. 22 CLI
5. System resources and potential bottlenecks (Ch.20 CLI)
6. Memory management demand paging, swapping, flushing (Ch. 21 CLI)
7. System tuning using mtune and stune files (Ch. 20 CLI)
8. How to use and decipher truss (man truss)
9. How to use NFS, rpc (NFS book, man NFS)
10. The purposes of the /proc file system (man proc)
(It resides in memory and does not require a separate disk slice.)
11. Use sar and sadc to manage your system (Ch. 16 CLI, Happys book)
12. Use crash to determine problems (panic, hang, slow system, etc.) and to find resolutions (man crash,
workbooks)
2. What file systems must UNIX have at a minimum to be able to run: (Happy)
root, filesystem type s5 or ufs, resides in slice 1
boot , filesystem type bfs, resides in slice 7
stand, filesystem type bfs, resides in slice 10
3. What are the Unix file systems: (notes)
Machine private files: (/) root file system. These are files that should not be shared with other machines.
Architecture dependent files: /usr file system. These files are sharable among machines of the same CPU type.
Architecture independent files: /usr/share directory.
Structure:
/ root
__________________________________________________________________________
dev export install mnt proc shlib tmp var
etc home lost+found opt sbin stand usr
Home, opt, stand, usr, and var are usually made into separate file systems. Some entries such as /bin, /lib, and /unix show
up but they are symbolic links to /usr/bin, /usr/lib, and /stand/unix.
4. Where are orphaned files and directories found: (TEC book)
In the /lost+found subdirectory of root.
5. What are the different directories for: (CLI Ch. A2)
/dev ,character and block special files.
/etc ,machinespecific administration configuration files and system administration databases
but no executables.
/export ,default root of the exported file system.
/home ,default root of subtree for user directories, formerly /usr/acct.
/install ,install scripts used during system installation.
/lost+found ,used by fsck for unreferenced files and directories.
/mnt ,default temporary mount point for file systems.
/opt ,default root of a subtree for addon application packages, formerly /appl.
/proc ,root of subtree for special type of file system, the process file system, which is a
mechanism for accessing the address space of a running process.
/sbin ,executables that are essential for booting and manual recovery. Some of these
administrative executables are also in /usr/bin or /usr/sbin.
/shlib ,used for shared libraries.
/stand ,default root of the new boot file system (type bfs). This must be in slice 'a' (slice is
equivalent to partition in previous releases of the operating system.
/tmp ,Small systemgenerated temporary files. This directory is cleared when the system
enters multiuser mode.
/usr ,root of a standard file system for static sharable files. Only /usr/share contains
architecture independent files. The others are architecture dependent.
/var ,root of a subtree for varying files such as log files.
6. Use of efficient path variables: (Ch. 233 CLI) (improve system performance)
Follow these guidelines:
1. The directory where most commands are retrieved from should be the first one in the PATH variable.
2. The PATH variable should contain as few directories as possible.
3. The PATH variable should never list a directory twice.
4. Long directory name should be avoided or be kept at the end of the PATH variable.
/etc/default/login contains the default PATH variable. The PATH variable in /etc/default/login lists the directories with the
most common commands. To add other directories to it, add a line in the /etc/.profile file.
For example:
PATH=$PATH:/usr/bin/X11: ,the ‘:’ causes the current directory to be searched last.
To change the PATH variable for a singleuser, set up the PATH variable in the $HOME/.profile file for that user.
7. Uses of metacharacters: (BT Ch. A)
* = matches any number of characters
? = matches a single character
[] = enclose a list of characters
Examples:
file* all files starting with 'file'.
f?les all files with 'f_les'.
f[ij]* all files that begin 'fi' or 'fj'.
[df]* all files that begin with 'd' or 'f'.
8. Shutdown a system: (BT Ch. 3, CLI Ch. 1)
# shutdown i6 g0 y (shutdown immediately and reboot)
# shutdown i0 gx y (shutdown in x seconds and don’t reboot)
# shutdown i0 y (shutdown in 60 seconds, default)
9. Reboot/Start the system: (BT Ch.3, CLI Ch.1)
Some ways
1. # init 6 (warm reboot)
2. init 0 (stop Unix completely)
Hit the power switch off and on.
3. # uadmin 1 2 (Perform reboot functions and reboot machine)
4. # shutdown i6 g0 y (shutdown immediately and reboot)
10. View your current run level:
# who r
11. Change run levels: (BT Ch. 3, CLI Ch. 1)
# init 2,3,4 There are also 0, s, 1, 6 levels. You must use init for the 2,3,4 levels.
# shutdown 0,s,1,6 You should use the shutdown command for 0,s,1,6 levels.
Examples:
# init 3
# shutdown i6 g0 y
12. Add and remove a package: (BT Ch. 10)
Add:
# pkgadd [n] [d device] [a admin] [r response] [pkg [pkg ...]]
# pkgadd s dir D R [d device] [pkg [pkg ...]] (spool the package)
# pkgadd d /dev/dsk/rmt0 (default is /var/spool/pkg)
# pkgadd
Example:
# pkgadd WINTCP
Remove:
# pkgrm [a admin] [pkg [pkg ...]]
# pkgrm n [a admin] pkg [pkg ...]
# pkgrm s spool [pkg [pkg ...]]
Example:
# pkgrm WINTCP
13. How to store packages: (BT Ch. 10)
# pkgadd s spool [d device] [pkginst] (default is /var/spool/pkg)
Example:
# pkgadd s spool d /usr/etc/spool WINTCP
14. How to display installed packages: (BT Ch. 10)
# pkginfo [x] [l] x=one line synopsis
l=long listing. This will tell you if the package is completely installed.
Example:
# pkginfo x
15. Check installed packages: (Ch. 10 BT)
# pkgchk [l] [i] l=long list
i=file
Example:
# pkgchk l WINTCP
16. Check spooled packages: (Ch. 10 BT)
# pkgchk d device (default is /var/spool/pkg)
Example:
# pkgchk d /usr/etc/spool WINTCP
17. How to use pkgtrans
# pkgtrans [ions] device1 device2 [ pkginst1 [ pkginst2 [ . . . ] ] ]
Examples:
1. The following example translates all packages on the floppy
drive /dev/dsk/f03ht and places the translations on /tmp.
# pkgtrans /dev/dsk/f03ht /tmp all
2. The next example translates packages pkg1 and pkg2 on /tmp
and places their translations (i.e., a datastream) on the
cartridge tape output device.
# pkgtrans /tmp c0t3d0s0 pkg1 pkg2
3. The next example translates pkg1 and pkg2 on tmp and places
them on the diskette in a datastream format.
# pkgtrans s /tmp /dev/dsk/f03ht pkg1 pkg2
4. Example of a package with subdirectories:
# find /directory print | cpio ocv > filename
# pkgtrans s `pwd` file /directory/filename
# pkgtrans s file /directory
18. Set the date, time, and timezone: (BT Ch. 4)
Procedure:
# init s
# date mmddHHMM[cc][yy]
Examples:
# init s
# date 1121190094 sets the date and time to 112194 at 7:00 PM
# init s
# TZ=PST8PDT; export TZ sets the timezone in your environment (.profile)
19. Display the date and time: (man date)
# date
20. Display the system name and the version number: (BT Ch. 5)
# uname nr (print the node name and the release)
21. Set the system name and the node name: : (BT Ch. 5)
# setuname [s name] [n node] [t]
Example:
# setuname s gladiator s name = the system name
n node = the network name
t = a temporary change
Subject: Changing unames and ynet addresses on 3600 Systems.
For a Baseline Release 2.0 3600 the ynet is restricted to the first two octets for the network id. The host id [ 3rd and 4th
octet] needs to be the tosprocnum [ (Cabinet number * 8) + (processor number)]. The 3rd octet is used when the 4th octet
exceeds 254. So the only part of this address that you can modify are the first two octets, netid, going from left to right.
If the uname is changed, on an AP, then you need to add an alias for the ynet address in /etc/hosts. That alias follows the
form AP[tosprocnum]. Ex; app0010 needs alias AP8 in /etc/hosts. Also edit /etc/systemid to match the uname.
If the uname is changed on the aws then you need to confirm that /etc/aws still contains the entry "aws1" and that the
private IP address for the aws contains the alias "aws1". There are executables for the aws that needs to see the entry
"aws1" in /etc/hosts and /etc/aws.
Icons cannot be modified in the aws. There are aws executables that are referencing the machine name and changing that,
in the icons, would cause problems. This is being addressed in releases after 2.1. So the icons in the awadm menu will still
show the regular "app????" name, even when the uname is changed. You can change the name for the ynet, but you still
have to have "app????" as an alias in /etc/hosts in order to do a lan connect from the aws.
In Baseline 3600 Release 2.1 the IP address restrictions have been lifted for the ynet. If ynet names are given that do not
follow the form "app????" then you need to add an entry to /var/console/dws.config nodename record for the AP. Below
the "name=app????" you need to add "alias=new_ynet_name" in order to do a lan connect from the aws.
If you are unable to update to 2.1 it is possible to install the ynet driver, from 2.1, onto a 2.0 system. Development has said
this can be done, but at present this has not been tested on a production system.
Change Unames:
Well, as most of you probably know, there is a file in /install/config called changeNodeName (attached below is a copy of
this file) that lists almost all of the system files that need to modified.
If the system is running with ORACLE's dlm, TOS and external SCSI devices, in addition to the files listed in
changeNodeName, you should also modify the following files:
usr/dlm/dlm_hosts
var/spi/hosts
copy the SCSI table to a different name so that mktable will rebuild a new table.
Standboot change TOS proc num
Must be in init 1
Run changeNodeName
Reboot (init 6)
The /etc/hosts file of other app's will need to be modified to reflect the name change
Need to change AWS icon see memo below
[begin]
*************************************************************
FILENAME: /install/config/changeNodeName
*****************************FIle Start Here ********************
#!/usr/bin/ksh
#############################################################
#
# COPYRIGHT (C) NCR CORPORATION 1989,1990,1991.
#
# Version #: $Id: changeNodeName,v 1.7 1994/02/04 00:29:00 ronl Exp $
#
# File: changeNodeName
# Description:
# Changes the name of the host from its current name to "newname" in
# the listed files and sets the uname of the APP or AWS.
#
# On APPs the ynet is the primary communication card so the uname of
# the system is set to the ynet's name. The name of the system's
# ethernet card (if any) is the host's name with "_e" as a suffix.
#
# On an AWS the uname of the system is the same as the name of the
# ethernet card since it is the primary (and only) communication
# card.
#
# Options: $1 "app" : change name of an APP (w/ ynet, w/o ethernet).
#
# "appe" : change name of an APP (w/ ynet, w/ ethernet).
#
# "aws" : change name of an AWS (w/ ethernet).
#
# $2 specifies the new name for the host.
#
# Updates:
# 07/11/90 Initial creation.
# 02/03/94 Add inetinit.cf to HOST_FILES list for dlyn driver
##########################################
# usage_error
#
usage_error() {
echo "Usage: changeNodeName [app | appe | aws] newname" >&2
echo >&2
echo " app : an app (w/ ynet, w/o ethernet)" >&2
echo " appe : an app (w/ ynet, w/ ethernet)" >&2
echo " aws : an aws (w/ ethernet)" >&2
exit 1
}
##########################################
#
# check_params
#
check_params() {
if [[ $# eq 0 || $# gt 2 ]] ; then
usage_error
elif [[ $1 != "app" && $1 != "appe" && $1 != "aws" ]] ; then
usage_error
fi
}
##########################################
#
# check_files
#
check_files() {
for i in $HOST_FILES
do
if [[ ! s $i ]] ; then
echo "changeNodeName: WARNING: $i: empty or nonexistant" >&2
fi
done
for i in $ENET_FILES
do
if [[ ! s $i ]] ; then
echo "changeNodeName: WARNING: $i: empty or nonexistant" >&2
fi
done
}
##########################################
#
# set_files
#
set_files() {
#
# Files containing the uname of the host:
#
HOST_FILES="/etc/rc2.d/S11uname \
/etc/rc2.d/S18setuname \
/etc/nodename \
/etc/systemid \
/etc/hosts \
/opt/net/tcpip/etc/hosts
/etc/net/ticlts/hosts \
/etc/net/ticots/hosts \
/etc/net/ticotsord/hosts\
/usr/etc/inetinit.cf \
/opt/net/tcpip/etc/inetinit.cf"
#
# Files containing the name of the host's ethernet card:
#
ENET_FILES="/usr/etc/inetinit.cf \
/opt/net/tcpip/etc/inetinit.cf \
/etc/hosts \
/opt/net/tcpip/etc/hosts"
}
##########################################
#
# set_names
#
set_names() {
OLD_HOST_NAME=`uname`
NEW_HOST_NAME="$2"
if [[ $1 = "appe" ]] ; then
OLD_ENET_NAME="$OLD_HOST_NAME"_e
NEW_ENET_NAME="$NEW_HOST_NAME"_e
elif [[ $1 = "aws" ]] ; then
OLD_ENET_NAME="$OLD_HOST_NAME"
NEW_ENET_NAME="$NEW_HOST_NAME"
fi
}
##########################################
#
# update_files
#
update_files() {
old=$1
new=$2
shift 2
FILES=$*
for i in $FILES
do
if [[ s $i ]] ; then
# Change the name throughout the file using the following
# possibilities for delimiters around the name:
# tab / tab
# tab / space
# tab / eol
# space / space
# space / tab
# space / eol
# bol / tab
# bol / space
# bol / eol
ed $i << EOF > /dev/null 2>&1
g/ ${old} /s// ${new} /g
g/ ${old} /s// ${new} /g
g/ ${old}$/s// ${new}/g
g/ ${old} /s// ${new} /g
g/ ${old} /s// ${new} /g
g/ ${old}$/s// ${new}/g
g/^${old} /s//${new} /g
g/^${old} /s//${new} /g
g/^${old}$/s//${new}/g
.
w
q
EOF
fi
done
}
##########################################
#
# main()
#
check_params $*
set_files
check_files
set_names $*
#
# Update the files containing the uname of the host
#
update_files $OLD_HOST_NAME $NEW_HOST_NAME $HOST_FILES
#
# IF the host has an ethernet card, update the files containing
# the name of the ethernet card
#
if [[ $1 = "aws" || $1 = "appe" ]] ; then
update_files $OLD_ENET_NAME $NEW_ENET_NAME $ENET_FILES
fi
uname S $NEW_HOST_NAME
exit 0
[end]
22. Display the network name:
# uname n
23. Display configuration information: (BT Ch. 5)
# prtconf (display device information)
# prtconf_cmos (display device information based on cmos information)
# findit (find devices on the system)
# prtconf_smbase (read the object table /etc/device.tab for the
information to be displayed)
24. Display the system’s configuration: (Ch. 510 BT)
# /usr/sbin/prtconf [b] (read the Object Table (device.tab) and
display the information)
Example:
# prtconf
25. List free processors:
# list_procs
26. Check processors:
# pinfo (this command shows whether they are online or offline.)
27. Set the processors online and offline:
Set processors online:
# online (for all processors)
# online 1 (for processor number one)
<or>
# online v 1
Set processors offline:
# offline
# offline 2
# offline v 2
28. Display classes currently configured in the system: (man priocntl)
# priocntl l (Process Scheduler Control)
29. Display who is on the system:
# who
30. How to determine who is using a specific file system:
# fuser cu file_system_name
This command will return a list of pid's that have open files. The file system must be mounted.
31. List files by age:
# ls t
<or>
# ls lat
32. Do a recursive list of a directory and it’s subdirectories and files: (man ls)
# ls R
33. See true file attributes and true file names:
# ls b
<or>
# hd /directory (hex dump the directory where the file is. Dumped in ASCII.)
Example:
# hd /tmp
34. Hide a file: (notes)
# >\backspace (create a file named backspace. Can’t see it, can’t rm what you can’t see.)
35. Make a file unreadable: (notes)
# >filename\backspace\backspace (this file has two backspaces appended to its name.)
36. Identify large space users: (CLI Ch. 2212)
# du /home (display the block count of all directories in /home)
# find /directory size <size> print (display all files and directories larger than a certain size)
Example:
# find /home size +10 print (display all files and directories larger than 10 512kbyte
blocks)
Note: Remember to set reasonable limits for your users.
37. Identify large files: (scripts and notes)
# find /directory size <size> print
<or>
Script from Mellisa Pike to Bess Cheong:
(begin)
#! /bin/sh
SIZE=1000000
DIR=`pwd`
OUT=/tmp/largefiles
if [ z "$SIZE" ]
then
echo "usage: findlarge filesize"
exit
fi
echo Looking for files greater than $SIZE bytes under $DIR and
echo printing them in $OUT.
echo ""
find . size +${SIZE}c print | xargs ls al > $OUT
echo Check $OUT for the filenames
(end of script)
38. Identify and remove inactive files: (CLI Ch. 2211)
# find /directory type f mtime +time print > /tmp/deadfiles & (find files older than
+time)
Remove the files based on your companies policy about unused files.
39. Identify large directories: (CLI Ch. 2214)
# find / type d size <size> print (you can use any size (+40, +96, etc.))
Example:
# find / type d size 40 print
40. Shrink large directories: (CLI Ch. 2214)
Do this procedure to remove unused entries in your directory:
# mv /directory /old_directory (rename the directory)
# mkdir /directory (create a new one)
# cd /old_directory
# find . print | cpio pdmuv /directory (copy the files back to the directory)
# cd /
# rm r /old_directory (remove the old directory)
41. How to move a directory across a file system: (man mv, man mkdir, man cpio)
Us this tar command:
# cd fromdir; tar cf . | (cd todir; tar xfBp )
<or>
Do one of the two following procedures:
1. If there are no subdirectories:
# mkdir dir2 (create a directory on the new file system)
# mv /dir1/* /dir2
2. If there are subdirectories:
# mkdir /dir2 (create a directory on the new file system)
# cd /dir1
# find . print | cpio pdm /dir2 (copy the files while inside the old directory)
# cd /
# rm r /dir1 (remove the old directory and it's files)
42. Display disk usage:
43. Display disk free space:
# dfspace (displays filesystems disk space available and total available)
44. Monitor files and directories that grow: (Ch. 22 CLI)
Some files and directories that grow daily are:
files
/usr/adm/wtmp
/var/cron/log
/usr/adm/sulog
directories
/tmp
/var/tmp
/var/spool
1. Controlling growth:
Check files periodically with the du command:
# du
Use the tail and move commands to keep files to a reasonable size.
Examples:
# tail 50 /var/adm/sulog > /var/tmp/sulog (create a file with the last 50 entries only)
# mv /var/tmp/sulog /var/adm/sulog (copy it over the old file)
2. Maintaining Start of Day Counts:
Examine free space at the start of day:
# df t
Examine output to make sure the following have enough free space for the daily activities:
/tmp
/var/tmp
/home
Any other user file systems
(You may have to increase their size or reslice the disk to make them larger)
45. Monitor and control disk space usage: (CLI Ch. 228)
# df t (display the number of free blocks and files)
If the number of free blocks and files is low you may need to add a new disk or reslice the current disk to reallocate space.
46. Create new kernels:
1. Go to singleuser mode if possible
# init s
2. Save the existing kernel
# cp /stand/unix /etc/conf/cf.d/unix.old
3. Create the new kernel
# /etc/conf/bin/idbuild
# shutdown i6 g0 y
If there is a problem you can reboot from the old kernel through the SUS menu.
47. Load and boot new kernels:
# cp /stand/unix /etc/conf/cf.d/unix.old (save the existing kernel)
# idbuild (create a new kernel)
# init 6 (load and boot the new kernel)
If there are problems go to the SUS menu and try to boot from other kernels. Use these kernels in the order presented
1. The unix you saved above (if it was the last one to work properly)
2. /stand/unix.old (this is a copy of the last kernel before the rebuild)
3. /stand/unix.diag (this is a copy of the latest kernel)
4. /stand/unix.ncrm (this is a basic, functioning kernel)
If you can’t reboot use the kernel from /install on the boot diskette to boot the system. Then copy one of these kernels to
/stand and reboot the system (this should preferably be the kernel you saved previously).
48. Check the dump area: (CLI, man page)
# dumpconfig m (displays zero if enough space is allocated)
49. Check where a dump is: (man page)
# fdump l
50. Do the memory dump procedure: (CLI Ch. 3)
Three ways:
1. If ctkdb is installed and there is a panic a ‘k0>‘ prompt will appear. Record the time, date, and any information displayed
on the screen. To have it save a dump type ‘go’ at the prompt:
k0> go (the system writes the comtents of memory to the dump area)
2. You can also type ‘sysdump’ at the prompt:
k0> sysdump
3. If ctkdb is not installed on the system, the system saves it’s memory automatically.
51. Save a dump to media: (CLI Ch. 3)
You will receive a message on your system that a dump has been temporarily saved. You now have three choices:
1. Save it to harddisk or removable media:
# dumpsave d /dev/rmt/device_name
Example:
# dumpsave d /dev/rmt/c0t0d0s0 (saved to tape)
# dumpsave d /dev/dsk/c0t3d0s0 (saved to disk)
2. Clear the dump flag:
# dumpsave c
3. The time limit is reached and the dump is cleared. The variable FLAG_TIMEOUT is in the /etc/default/dump directory.
52. Save a dump to a file:
# /sbin/ldsysdump t [d device]
# /sbin/ldsysdump o filedescriptionlist [v] [O unixfile] [s]
# /sbin/ldsysdump o filedescriptionlist [d device] [O unixfile] [s]
Examples:
In the following example, ldsysdump will print the information contained in the tape's header. An error message
will be printed if the media does not contain a valid header. No files will be created in either case.
# ldsysdump d /dev/rmt/c0t0d0s0 t
In the next example, ldsysdump will attempt to write the entire dump to the designated file. The kernel will also be
written to the specified file. Since the device option was omitted, ldsysdump will present a device menu and prompt for
a selection.
# ldsysdump o /dumps/star.dump O /dumps/star.unix
In this example, the first 32MB of the dump will be written to /dumps/dump1. If the dump is larger than 32MB, the
next 65MB will be written to /spare/dump2. Any remaining dump
will be copied to /tmp/dump3. Since the O option is missing, dumpUnix will be created in the current directory to
contain the kernel.
# ldsysdump o /dumps/dump1=32m,/spare/dump2=65m,/tmp/dump3
53. Add dump area: (CLI)
# fdump a device dumplow dumplen
# /usr/sadm/sysadm/bin/mktable &
device = SCSI device
dumplow = offset from the beginning of slice
dumplen = length to add in 512k blocks
Example:
# fdump a /dev/dsk/c0t0d0s6 0 10240
# /usr/sadm/.sysadm/bin/mktable &
Note:
The dump space should be equal to the size of memory.
54. Remove the dump area: (CLI):
Procedure:
# fdump d device swaplow
# /usr/sadm/sysadm/bin/mktable &
Example:
# fdump d /dev/dsk/c0t0d0s6 0
# /usr/sadm/sysadm/bin/mktable &
55. Check the swap space: (CLI)
# swap l (list the status of all swap areas)
56. Add swap space: (CLI)
Create the swap area:
# swap a device swaplo swaplen u
Run mktable:
# /usr/sadm/sysadm/bin/mktable &
device = scsi device
swaplo = offset from the beginning of the slice
swaplen = length added in 512k blocks
Example:
# swap a /dev/dsk/c0t0d0s2 0 10240 u
# /usr/sadm/sysadm/bin/mktable &
Note:
Swap space should be twice the memory size.
57. Remove swap space: (CLI)
Delete the swap area:
# swap d device swaplo u
Run mktable:
# /usr/sadm/sysadm/bin/mktable &
device = scsi device
swaplo = offset from the beginning of the slice
Example:
# swap d /dev/dsk/c0t0d0s2 0 u
# /usr/sadm/sysadm/bin/mktable &
58. Add a swap file: (Ch. 419 AT, man swap)
Add
1. Login as root.
2. Set the ulimit. You must enter the number of blocks to be allocated to the swap file:
# ulimit limit
Example:
# ulimit 10000 (this is a 5MB swap file of 512k blocks)
3. Create an empty file:
# dd if=/dev/zero of=/swap2 bs=512 count 10000
4. Change the permissions on the swap file:
# chmod 600 /swap2
5. Add it to the swap area:
# swap a /swap2 0 10000
6. Make sure that it was configured properly:
# swap l
59. Remove a swap file: (Ch. 419 AT, man swap)
1. Put the system in singleuser mode:
# init s
2. Prevent the kernel from swapping to the file:
# swap d /swap_filename
Example:
# swap d /swap2 0
3. Delete the swap file:
# rm swap_filename
60. Mount and Exit the maintenance file system:
Mount:
1. Boot from floppy diskette:
# init 6
2. Type a '2' ( to mount the maintenance floppy) then a 'y'es when you get the menu to go
into maintenance mode.
Exit:
CTRLD
61. Check a file system from the maintenance file system: (CLI 341)
1. Reboot from flex diskette.
2. Mount the maintenance diskette.
3. Determine the root file system:
# ls l /dev/rdsk/*
4. Run fsck:
# fsck F ufs /dev/rdsk/device_name (can also be an s5 file system)
5. Exit the maintenance file system:
CTRLD
62. Mount and unmount a file system:
Mount:
# mount /dev/dsk/cntndnsn /mntpoint
Unmount:
# umount /dev/dsk/cntndnsn
# umount /mntpoint
63. Display mounted file systems:
# mount v (display in vfstab format)
The file /etc/mnttab contains information about mounted devices. It contains the fields: block special device, mount point,
file system type, mount options, and time mounted. Device names are stored in the /dev directory.
The file /etc/vfstab is the file systems defaults file. It contains information about which file systems are to be mounted and
in what manner. These defaults are also used during file system checking. The fields it contains are: block special device,
character special device, default mount point, file system type, pass number, automount, and mount options.
64. Display and check file system defaults: (man fsck, man fstyp)
1. Determine file system type:
# fstyp [v] special
Example:
# fstyp /dev/dsk/c0t5d0s1
2. Check the file system but don't repair:
# fsck F FSTyp m /dev/dsk/device_name
<or>
Check and repair the file system:
# fsck F FSTyp /dev/dsk/device_name
Example:
# fsck F ufs /dev/dsk/c0t6d0s8
65. Create an s5, ufs, bfs, nfs, vxfs file system: (Ch. 4 AT and CLI)
# mkfs [F] [v] [m] [current options] [o specific options] special [operands]
Examples:
# mkfs F s5 /dev/rdsk/c0t0d0s4 20000
# mkfs F ufs o bsize=4096 /dev/rdsk/c0t1d0s1 41000
# mkfs F bfs /dev/dsk/c0t0d0s1 20480
Note: If OA&M or OSA is installed run mktable to update the object table with the new file system you created:
# /usr/sadm/sysadm/bin/mktable &
66. See a list of file system types installed in the kernel:
# crash
> vfssw
67. Repair the root file system: (CLI Ch. 5)
# fsck y /dev/rroot
68. Restore corrupted root file systems: (Ch. 6 CLI, man cpio, workbooks)
1. Reboot from flex disk and choose option number two Perform System Maintenance.
2. Mount the maintenance diskette.
3. Fsck the root file system
# /install/etc/fs/ufs/fsck y /dev/rdsk/device_name (can also be an s5 file system)
4. If fsck is successful
# cd /
# mount F FSTyp /dev/dsk/device_name /mnt
# cd /mnt
# ulimit unlimited
# /install/usr/bin/cpio icvBdm I /mnt/dev/rmt/device_name (restore the root file system from
your device)
Note: If fsck reports severe data loss include the letter ‘u’ in cpio.
If fsck is not successful
You must either reinstall and restore root from backup
<or>
You must recover the entire root disk from backup.
69. Repair a nonroot file system: (CLI Ch. 5)
# fsck y /dev/rdsk/cntndnsn
Example:
# fsck y /dev/rdsk/c0t6d0s3 (you may have to specify the file system type with F.)
70. Eliminate file system fragmentation: (CLI Ch. 2216)
For an s5 or ufs file system type
Using the dcopy command:
1. Enter singleuser mode:
# init s
2. Unmount the file system to be copied:
# umount /s5_dir
3. Run fsck on the file system:
# fsck F ufs /dev/dsk/c0t6d0s8
4. Copy the file system to a spare disk using vlocopy:
# volcopy [F FSType] [V] [current_options] [o specific_options] operands
Example:
# volcopy /s5_dir /dev/rdsk/c0t6d0s3 /dev/rmt/c0t3d0s0
5. Copy it back to the original drive using dcopy: (currently dcopy is only for s5 file systems)
# dcopy [F FSType] [V] [current_options] [o specific_options] inputfs outputfs
Example:
# dcopy F s5 /dev/rmt/c0t3d0s0 /dev/rdsk/c0t6d0s3
6. Run fsck on the file system:
# fsck F ufs /dev/dsk/cot6d0s8
7. Go to multiuser mode:
# init 6
If there is not enough free space to use the dcopy command then use this method:
1. Enter singleuser mode:
# init s
2. Back up the file system using cpio:
# cd /directory
# find . print > /tmp/backuplist
# cpio ocvB < /tmp/backuplist O /dev/rmt/device
3. Unmount the file system:
# umount /usr
4. Recreate the file system using the mkfs command:
# mkfs F ufs /dev/dsk/cot6d0s8
5. Restore the file system using cpio:
# cpio icvBdmul I /dev/rmt/c0t3d0s0
6. Go to multiuser mode:
# init 6
For a Journaling File System (vxfs)
# fsadm e ,reorganize file extents.
# fsadm d ,reorganize directories.
71. Setup an automatic file system check: (CLI Ch. 19, man vfstab)
(this is not recommended)
In the file /etc/vfstab set the field 'fsckpass' to '1' for each file system you want checked. To see which column is the
fsckpass field do a man page on vfstab.
72. What are init, inittab, cron, crontab, crontabs, mount, vfstab, and mnttab: (man init, man inittab,
man cron, man crontabs, man mount, man vfstab, man mnttab)
Init is the startup daemon
Inittab controls process dispatch by init (usually daemons)
Cron is the clock deamon
Crontab is a command that is used to enter information in the user crontabs files
Crontabs are files in the /crontabs directory that contain user jobs for cron to run
Mount is used to mount file systems
Vfstab contains file system information for mount
Mnttab contains mounted file system information
73. How does init and inittab work: (CLI Ch.1 man init, workbooks)
When the system boots init sequentially scans the /etc/inittab file looking for a special entry the initdefault entry. This
entry specifies the state into which init should take the system at boot. By default it is state 2. After init determines the
default system state it searches for the 'boot' and the 'bootwait' entries. These two entries are executed before init continues.
Note: When a new kernel is created (/unix is rebuilt), the file /etc/conf/cf.d/init.base replaces the /etc/inittab file. If any
changes are made to the /etc/inittab file you need to make sure that you copy the new inittab file to /etc/conf/cf.d/init.base.
Each entry in the /etc/inittab file has 4 fields separated by colons:
Field one Line Identifier: A 14 character userdefined name which serves to uniquely identify the entry.
Field two State(s): Indicates in which states to execute the command line in the entry. The numbers
0,1,2,4,5,6 are valid. If this field is empty the command will be executed for all system states.
Field three Action: Indicates an action to be taken as /sbin/init executes the command. Possible actions
are:
off Terminate the command if it is executing.
once Execute the command one time.
sysinit Execute the command whenever entering the specified system state. Used for
initializing the system.
initdefault Specifies the default system state.
wait /sbin/init sequentially processes the entries in the /etc/inittab file. By specifying
wait init will wait until the command completes execution before proceeeding to
the next entry in inittab.
respawn /sbin/init continully checks the process this entry started, to be sure the
command is continuing to execute. If the command terminates for any
reason, except a change in the system state where the command is not
defined, init restarts it.
boot These are the first entries to be executed if the system is entering this state after
a boot.
bootwait Same as boot, but init does not proceed until the command has terminated.
powerfail These entries are performed when init receives a power fail signal. Cleanup
operations are performed before the system powers down.
powerwait Same as powerfail except init does not proceed until the command has
terminated.
Field four Command: The command line init is to execute.
Init keeps a log of all processes it spawns in the file /var/adm/wtmp. A log of all processes that have died and the reason for
termination is kept in the file /var/adm/utmp.
Example of an inittab file:
cc::off:/sbin/chkconsole >/dev/sysmsg 2>&1
ap::sysinit:/sbin/autopush f /etc/ap/chan.ap
aj::sysinit:/sbin/rm f /dev/vol/?* /dev/rvol/?* /dev/plex/?*
ak::sysinit:/sbin/wsinit 1>/etc/wsinit.err 2>&1
ck::sysinit:/sbin/setclk </dev/console >/dev/sysmsg 2>&1
bchk::sysconf:/sbin/bcheckrc </dev/console >/dev/sysmsg 2>&1
dupd::sysconf:/sbin/chk_update </dev/console >/dev/sysmsg 2>&1
is:3:initdefault:
a0:0123456:wait:/sbin/contty c 1> /dev/sysmsg 2>&1
r0:0:wait:/sbin/rc0 off 1> /dev/sysmsg 2>&1 </dev/console
r1:1:wait:/sbin/rc1 1> /dev/sysmsg 2>&1 </dev/console
r2:23:wait:/sbin/rc2 1> /dev/sysmsg 2>&1 </dev/console
r3:3:wait:/sbin/rc3 1> /dev/sysmsg 2>&1 </dev/console
r5:5:wait:/sbin/rc0 reboot 1> /dev/sysmsg 2>&1 </dev/console
r6:6:wait:/sbin/rc6 reboot 1> /dev/sysmsg 2>&1 </dev/console
sd:0:wait:/sbin/uadmin 2 0 >/dev/sysmsg 2>&1 </dev/console
fw:5:wait:/sbin/uadmin 2 2 >/dev/sysmsg 2>&1 </dev/console
rb:6:wait:/sbin/uadmin 2 1 >/dev/sysmsg 2>&1 </dev/console
li:23:wait:/usr/bin/ln /dev/systty /dev/syscon >/dev/null 2>&1
nw:12345:powerwait:/sbin/rcpfr 1> /dev/sysmsg 2>&1 </dev/console
sc:234:respawn:/usr/lib/saf/sac t 300
co:0123456:respawn:/sbin/getty console
vt2:234:respawn:/sbin/getty vt02
vt3:234:respawn:/sbin/getty vt03
pf::powerfail:/etc/powerfail </dev/console >/dev/sysmsg 2>&1
74. How to use /etc/mnttab (TEC book, man mnttab, see 74):
Mnttab contains mounted file system information. It is used by the mount and umount commands to keep track of the
currently mounted file systems. It is an ascii file which is easily read. This file has one entry per mounted file system.
Each entry contains the following information:
Block mount device
Mount point directory
File System Type
Mount options for file system type
Time of mount in seconds since 00:00:00 January 1, 1970 GMT
The /etc/mnttab file is not used by the operating system, but is provided to allow administrators the ability to monitor
active file systems.
Example of the /etc/mnttab file:
/dev/root / ufs rw,suid 690469216
/proc /proc proc rw 690469217
/dev/fd /devfd fdfs rw 690469217
/dev/dsk/c0t6d0s3 /usr s5 rw,suid 690469222
/dev/dsk/c0t6d0s4 /home s5 rw,suid 690469222
/dev/dsk/c0t6d0sa /stand bfs rw 690469223
/dev/dsk/c0t6d0s1 /home1 s5 rw,suid 690478068
75. How to use /etc/vfstab (man vfstab, see 74, 78):
Vfstab contains file system information for mount. The file /etc/vfstab describes defaults for each file system. It is an ascii
file and is easily read. The fields in the table are whitespaceseparated and are shown below:
The block special or resource name
The raw device to fsck
The default mount directory
The name of the file system type
The number used by fsck to decide whether to check the file system automatically
Whether the file system should be mounted automatically by mountall
The mount options. A '' is used to indicate no entry in a field.
Here is an example /etc/vfstab file:
/dev/root /dev/rroot / ufs 1 yes
/dev/dsk/c0t6d0s4 /dev/rdsk/c0t6d0s4 /home ufs 1 yes
/dev/dsk/c0t6d0sa /dev/rdsk/c0t6d0sa /stand bfs 1 yes
/dev/dsk/c0t6d0sb /dev/rdsk/c0t6d0sb /var ufs 1 yes
/dev/dsk/c0t6d0sc /dev/rdsk/c0t6d0sc /home2 ufs 1 yes
/dev/dsk/c0t6d0sd /dev/rdsk/c0t6d0sd /opt ufs 1 yes
/dev/dsk/c0t5d0s2 /dev/rdsk/c0t5d0s2 /tmp ufs 1 yes
/dev/dsk/c0t5d0s3 /dev/rdsk/c0t5d0s3 /usr ufs 1 yes
/dev/dsk/c0t5d0s4 /dev/rdsk/c0t5d0s4 /home3 ufs 1 yes
/dev/dsk/c0t5d0s6 /dev/rdsk/c0t5d0s6 /home4 ufs 1 yes
/dev/dsk/c0t5d0s8 /dev/rdsk/c0t5d0s8 /home5 ufs 1 yes
/dev/dsk/c10t0d0s1 /dev/rdsk/c10t0d0s1 /OLD/dumps/3600app ufs
/dev/dsk/c10t1d0s1 /dev/rdsk/c10t1d0s1 /OLD/dumps/disk1 ufs
/dev/dsk/c10t2d0s1 /dev/rdsk/c10t2d0s1 /OLD/dumps/disk2 ufs
76. If vfstab is wrong and you want to check a file system type:
# fstyp [v] special
# fstyp v /dev/dsk/cntndnsn v=verbose. Displays superblock information, etc.
Example:
# fstyp v /dev/dsk/c0t5d0s1
77. How does cron, crontab, crontabs, and the at command work: (workbooks, man cron,
man crontabs, man crontab)
Cron: is the clock daemon. It executes commands at specified dates and times as it reads them from the crontabs files or it
executes a command once with the user executing the 'at' command.
The 'at' and 'crontab' commands force cron to examine the crontabs files. Otherwise, cron examines these files at process
initialization. Cron is executed at boot time.
Crontab: Do not exit this command using CTRLD, use the DEL key instead or you can delete all entries in your crontabs
file. You can only use the crontab command if your name appears in the /etc/cron.d/cron/allow file. If this file does not
exist then only root can use the crontab command.
Crontab examples:
# crontab [file] ,copy file or STDIN to your crontabs directory.
# crontab e [username] ,edit the users crontab file or create an empty one. Default editer is vi.
# crontab r [username] ,Remove the users crontab file.
# crontab l [username] ,list the crontab file for the user. Only a priveleged user can specify this
action.
Crontabs file: There are six fields minute, hour, day, month, day of the week, and command string.
Layout:
minute hour day month dayofweek(0=Sunday) command
059 023 131 112 06 fsck, etc...
A '*' in any field equals all legal values. Fields are usually separated by a space.
A '%' = a newline character.
A '#' = a comment.
The first line of the sixth field is a string executed by the shell. The following lines are STDIN to the command.
Examples of the first 5 fields:
0 0 1,15 * 1
This command runs on the 1st and the 15th, if it is a Monday, every month at midnight.
0 0 * * 1
This command runs on every Monday at midnight.
Some sample lines of a system's /var/spool/cron/crontabs/root file:
17 5 * * 0 /bin/su root c "/sbin/cleanup > /dev/null"
0 0 * * * /sbin/updatelog
7 2 * * 0 /usr/lib/saf/logchecker > /dev/null 2>&1
The 'at' command:
# at [f script] [m] time [date] [+ increment]
# at l [job ...]
# at r job ...
# batch (similar to the at command)
script = file of your commands to feed into the at command.
job = jobs scheduled.
l = list scheduled jobs.
r = remove specified jobs.
End the batch command by pressing CTRLD.
78. How to schedule tasks: (man cron, man crontabs)
Enter the task information into your user crontabs file. Use crontab, at, batch commands or vi to do this.
Example:
0 23 1 * * fsck F bfs /dev/dsk/c0t6d0sa
This command will execute at 11PM on every day that is the 1st, of every month.
Example:
0 0 * * 2 mount F bfs /dev/dsk/c0t6d0sa
This command runs every Tuesday at midnight.
79. Schedule a backup: (BT, workbooks, man cpio, man dd, man cron, man crontabs, man at)
Use a crontabs entry, the at command, or the batch command.
Example of a crontab entry:
0 0 * * * find . print | cpio ocvB O /dev/rmt/device
0 1 * * 0 dd if=/dev/rdsk/c0t5d0s0 bs=512k of=/dev/rmt/device
The first command runs every day at midnight.
The second command runs every Sunday at 1AM.
80. Change, display, and delete scheduled backups: (BT, man cpio, man cron, mna crontabs, workbooks)
Use vi to edit the crontabs file.
Use the crontabs command.
Use the at command.
81. Erase contents of storage devices: (man tapecntl, Ch. 11 BT)
# tapecntl e [d device] ,default device = /dev/rmt/c0t3d0s0
Example:
# tapecntl e d /dev/rmt/c0t4d0s0
82. List reserved devices: (Ch. 11 BT)
# devreserv
83. Rewind and retension a tape: (CLI Ch. 6)
# tapecntl [e] [t] [w] [d device_name] e=erase data
w=rewind tape
d=for tape devices that are not
the default tape device.
Example:
# tapecntl t d /dev/rmt/c0t4d0s0
<or>
# < /dev/rmt/c0t3d0s0 (rewind the tape)
84. Copy to a tape drive:
Single file:
# cpio ocvB < /directory/filename O /dev/rmt/device
Multiple files:
# cd /directory
# find . print > /tmp/backuplist
# cpio ocvB < /tmp/backuplist O /dev/rmt/device
Note: If you are backing up the root file system you must remove any /proc and /dev/fd entries from your backup list. You
can’t back these files up.
Here is how you remove these entries:
# grep V " \ . \ /proc \ / " /tmp/backuplist > /tmp/templist
# grep V " \ . \ /dev/fd \ / " /tmp/templist > /tmp/backuplist
85. Copy to a flex diskette:
Single file:
# cpio ocvB < filename O /dev/rdsk/f03ht
# cpio ocvB < /directory/filename O /dev/rdsk/f03ht (f03ht = SCSI device)
Multiple files:
# cd /directory
# find . print > /tmp/backuplist
# cpio ocvB < /tmp/backuplist O /dev/rdsk/f03ht
Note: If you are backing up the root file system you must remove any /proc and /dev/fd entries from your backup list. You
can’t back these files up.
Here is how you remove these entries:
# grep V " \ . \ /proc \ / " /tmp/backuplist > /tmp/templist
# grep V " \ . \ /dev/fd \ / " /tmp/templist > /tmp/backuplist
86. Restore from a tape drive:
# cd /directory
# cpio icvBdmul I /dev/rmt/device [pathname]
Example:
# cd /home
# cpio icvBdmul I /dev/rmt/c1t3d0s0
Note: Pathname must be exactly the same as when you copied the files during backup. If the pathname is not used then all
files on the tape are restored instead of just the ones you want.
87. Restore from a flex diskette:
# cd /directory
# cpio icvBdmul I /dev/rdsk/device [pathname]
Example:
# cd /home
# cpio icvBdmul I /dev/rdsk/c0t3d0s0
Note: Pathname must be exactly the same as when you copied the files during backup. If the pathname is not used then all
files on the tape are restored instead of just the ones you want.
88. Parition a disk: (Ch. 7 CLI)
# fdisk /dev/rdsk/device_name
Example:
# fdisk /dev/rdsk/c0t5d0s0
89. Change the active partition: (Ch. 7 CLI, man fdisk)
# /sbin/fdisk (partition disk and create/update master boot block)
Choose option number 2 'Change Active Partition
Examples:
# /sbin/fdisk
# /sbin/fdisk /dev/dsk/c0t5d0s0
90. Slice a disk: (Ch.7 CLI)
Note: Backup all data first (if the new slicing is smaller than the old slicing then you can lose data).
During the installation process you create slices:
<or>
1. # cd /
# prtvtoc f acsii_file /dev/rdsk/device_name (create a file of the old slice info)
# vi ascii_file (change start and size columns. Remember
don’t use carriage returns or overlap slices)
# edvtoc f acsii_file /dev/rdsk/device_name (write back the new slicing information)
2. Use mkfs to create file systems in your slices if necessary.
3. Restore the data.
4. If you do not plan to mkae file systems on the disk right away, rum mktable to update the object table:
# /usr/sadm/sysadm/bin/mktable &
91. Display disk slicing: (Ch. 7 CLI)
# prtvtoc /dev/rdsk/device_name
Example:
# prtvtoc /dev/rdsk/c0t5d0s0
92. Perform a selective backup of files and directories: (CLI Ch.6, man cpio, man dcopy)
See the following entries for the option you desire.
1. Backup a single directory:
# cd /directory
# find . print | cpio ocvB > /dev/rmt/tape_device
<or>
# find pathname_of_directory print | cpio ocvB > /dev/rmt/device_name
2. Backup multiple directories:
# find list_of_pathnames_of_directories print | cpio ocvB O /dev/rmt/device_name
Example:
# find /home/user1 /home/user2 print | cpio ocvB O /dev/rmt/c0t3d0s0
O = multiple volume backups
3. Backup individual files:
# find path print | cpio ocvB O /dev/rmt/device_name
Examples:
# find /home/user1/*.c print | cpio ocvB O /dev/rmt/c0t3d0s0
# find /home/user?/prog[15].c print | cpio ocvB O /dev/rmt/c0t3d0s0
# find / name ‘’*.dbf’’ print | cpio ocvB O /dev/rmt/c0t3d0s0
93. Restore individual files, directories, file systems, and slices: (CLI Ch.6, man cpio, man dcopy)
# cd /directory
# cpio icvBdmul I /dev/rmt/device_name [‘’Pathname’’]
# cd /
# umount file_system
# fsck F FSTyp /dev/rdsk/device_name
Example:
# cd /usr
# cpio icvBdmul I /dev/rmt/c0t3d0s0
# cd /
# umount /usr
# fsck F ufs /dev/rdsk/c0t5d0s8
94. Backup a file system/slice: (CLI Ch.6, man dd, man volcopy)
1. Put the system in singleuser mode. Also reboot if you are backing up the root file system:
# init s
<or>
# shutdown i6 g0 y
# init s
2. Unmount the file system:
# umount file_system
3. Fsck the file system:
# fsck F FSTyp /dev/rdsk/device
4. Now you must create a backup list for every slice which contains a file system that you want to backup. Do not create a
backup list containing files from both root and /stand. This is so you avoid restoring more than one file system to the
same physical slice. Examples:
Create a backup list for root:
# cd /
# find . mount print > /tmp/backup.root
# echo ‘’./proc’’ >> /tmp/backup.root
# echo ‘’./dev/fd’’ >> /tmp/backup.root
Create a backup list for /stand:
# cd /stand
# find . print > /tmp/backup.stand
Create a backup list for /usr:
# cd /usr
# find . print > /tmp/backup.usr
Create a backup list for /var, /tmp/var, and /home:
# cd /directory
# find . mount print > /tmp/backup.directory
5. Backup each file to disk or tape:
# cpio ocvB < /tmp/backup.list O /dev/rmt/device_name
95. Backup a raw device: (CLI Ch. 6, man cpio)
(A raw device is a slice on a disk without a file system)
1. Go to singleuser mode.
# init s
2. Shutdown any databases and daemons which may write to the raw slice:
# fuser /dev/dsk/device_name (display the IDs of processes using the device.)
3. Backup the slice:
# dd if=/dev/rdsk/slice_name bs=512k of=/dev/rmt/device_name
Example:
# dd if=/dev/rdsk/c0t0d0s4 bs=512k of=/dev/rmt/c0t3d0s0
96. Restore a raw device: (CLI Ch. 6, man cpio)
(A raw device is a slice on a disk without a file system)
1. Go to singleuser mode.
# init s
2. Shutdown any databases and daemons which may write to the raw slice.
3. Backup the slice:
# dd if=/dev/rdsk/slice_name bs=512k of=/dev/rmt/device_name
Example:
# dd if=/dev/rdsk/c0t0d0s4 bs=512k of=/dev/rmt/c0t3d0s0
4. Make sure no daemons are running that could write to the raw slice:
# fuser /dev/dsk/device_name (display the IDs of processes using the device.)
5. Restore the slice:
# dd if=/dev/rmt/device_name bs=512k of=/dev/rdsk/slice_name
Example:
# dd if=/dev/rmt/c0t3d0s0 bs=512k of=/dev/rdsk/c0t0d0s4
97. Backup a UNIX disk: (CLI Ch. 6, man cpio)
Two steps:
1. Backup each file system.
2. Copy the /etc/vfstab file, the vtoc slicing, partitioning information, and the parameters used to create the file systems
with.
Described in detail:
1. Backup each file system: (see 95 and 96 for more info)
# cd /directory
# find . print > /tmp/backuplist
# cpio ocvB < /tmp/backuplist O /dev/rmt/device
2. Mount the maintenance disk or a blank disk:
# mount F s5 /dev/dsk/f03ht /mnt
Make a restore directory and cd to it:
# mkdir /mnt/restore
# cd /mnt restore
Now copy the files:
# cp /etc/vfstab /mnt/restore
# prtvtoc f filename /dev/rdsk/diskname (there is a different name for each disk.)
Example:
# prtvtoc f c0t6d0s0 /dev/rdsk/c0t6d0s0
Use fdisk to copy each disks partitioning information:
# echo 5 | fdisk /dev/rdsk/c0t6d0s0 > fdisk6
Save the file system parameters for each disk:
# mkfs F ufs m /dev/dsk/c0t5d0s1 > fs.home (this example assumes that home is a
separate file system.)
3. Print out hard copies of all of these files.
4. Unmount the maintenance file system:
# cd /
# umount /mnt
98. Restore a UNIX disk: (CLI Ch. 6, man cpio)
Refer to your saved vfstab file on the maintenance disk for the file system type and mount point for each file system on the
disk. Note: Path names on the backup media must not begin with a ‘/’).
Tasks that will be performed:
1. Repartition and reslice the disk (reconfigure).
2. Restore root and /stand from the maintenance diskette.
3. Restore other file systems in songleuser mode.
4. Restore all slices in a nonroot disk (/usr must be restored in singleuser mode).
1. Reconfigure a disk:
Mount the maintenance diskette after booting from flex disk.
Step 1: Partition the disk:
# fdisk /dev/dsk/c0t6d0s0 (if the disk is not 100% Unix reference the file you saved.)
Select Update and exit.
Step 2: Initialize the Unix partition:
# dklayout pvd /dev/rdsk/c0t6d0s0
Step 3: Update the Volume Table of Contents with the slicing information you saved:
# edvtoc f /maint/restore/c0t6d0s0 /dev/rdsk/c0t6d0s0
(the /maint directory is used for accessing the maintenance file system. You would
use the /mnt directory for backups.)
2. Restore data to the root disk: (used for root, /stand, /usr. You can’t restore /usr from the
maintenance diskette if it is a vxfs file system. To bring the
system to singleuser mode you must have these three file
systems).
Step 1: Create and mount the file systems using the information you saved before.
Step 2: Determine the major and minor numbers of the tape device node:
# /usr/sadm/sysadm/bin/nodes d /dev/rmt/c0t3d0s0
Step 3: Create the tape device node:
Example:
# mknod /dev/rmt/c0t3d0s0 c 35 67
Step 4: Reset the user file size limit to unlimited:
# ulimit unlimited
Step 5:
# cd /mnt
Step 6: Restore the root file system from tape:
# cpio icvBdmul I /dev/rmt/c0t3d0s0
Step 7:
# cd /mnt/stand
Step 8: Restore /stand:
# cpio icvBdmul I /dev/rmt/c0t3d0s0
Step 9: Copy the boot program from your restored root file system to the BOOT slice 7 (blocks 128):
# dklayout b f /mnt/etc/boot
Step 10: Do fsck after unmounting /stand:
# umount /mnt/stand
# fsck F FSTyp /dev/rdsk/device_name
For example:
# fsck F bfs /dev/rdsk/c0t6d0sa
Step 11: Do fsck on root:
# umount /mnt
# fsck F FSTyp /dev/rdsk/device_name
For Example:
# fsck F ufs /dev/rdsk/c0t6d0s1
Step 12: Exit from the maintenance file system:
CTRLD
3. Restore the remaining file systems on the root disk from Singleuser mode:
Step 1:
# init s
Step 2: Recreate every file system residing on the root disk using the information you saved on diskette:
# mkfs F FSTyp [o FSTyp specific options] /dev/rdsk/device_name
Step 3: Verify that all of your file systems residing on the root disk (which are to be restored) are mounted:
# mount
If they are not mounted then mount each one:
# mount F FSTyp /dev/dsk/device_name /mount_point
Step 4: For each file system to be restored, change to it’s mount point:
# cd /mount_point
Step 5: Copy from backup each file systems data:
# cpio icvBdmul I /dev/rmt/device_name
Step 6: Reboot the system so that all file systems will be checked for possible corruption:
# cd /
# shutdown g0 i6 y
99. Backup an entire system: (CLI Ch.6, man dd, man volcopy)
Follow these procedures:
Step 1. Backing up file systems and disk information (CLI 621, see 100)
Step 2. Backing up file systems (CLI 64, see 96)
Step 3. Backing up raw devices (CLI 617, see 98)
100. Restore an entire system: (CLI Ch.6, man dd, man volcopy)
Follow these procedures:
1. Restoring an entire disk (follow the steps for restoring the root disk). (See 101)
2. Repeat number 1 , for every nonroot disk (follow the steps for restoring nonroot disks).
101. How to make a device node: (man mknod, workbooks)
# mknod /dev/rmt/device_name n major minor c=character special device, can be other types.
Example:
# mknod /dev/rmt/c0t3d0s0 c 35 48
102. Replace a corrupted device file (man mknod, man nodes):
# nodes d /dev/dsk/device (get major and minor number)
# mknod /dev/dsk/device c major,minor (create the device node)
c = a character special device. (Can use other options here)
Example:
# nodes d /dev/dsk/c0t6d0s0
35 96
# mknod /dev/dsk/c0t6d0s0 c 35,96
103. Compact files in /stand: (CLI Ch. 4)
1. Check the free space in /stand:
# df t
2. Copy all the files in /stand to another directory:
# cp /stand/* /mytemp
3. Make a new file system:
# mkfs F bfs /dev/dsk/device_name 20480 (device_name is the name of the slice containing
/stand).
4. Copy the files one at a time from the temporary directory back to /stand:
# cp /mytemp/filename /stand
5. Link:
# ln s /stand/unix /unix
# sync
104. Recover the root password: (CLI Ch. 3)
1. Boot from the maintenace diskette.
2. Find the root file system nodes (these are the device nodes that show up)
# ls l /dev/rdsk/*
3. fsck on the root file system
# fsck F fstyp /dev/rdsk/device
Example:
# fsck F ufs /dev/rdsk/c0t5d0s0
4. Mount the root file system
# mount F type /dev/dsk/device /mnt
5. Edit the /mnt/etc/shadow file
# vi /mnt/etc/shadow (remove the encrypted password for root and save the file)
6. Make sure the root password in /mnt/etc/passwd is blank or an ‘x’ (The ‘x’ means that you are not asked
for a password when you login as root). If it is encrypted then edit this file also.
7. Now login as root and enter the new password.
105. Recover /etc/password: (CLI Ch. 3)
1. Boot from the maintenace diskette.
2. Find the root file system nodes (these are the device nodes that show up)
# ls l /dev/rdsk/*
3. fsck on the root file system
# fsck F fstyp /dev/rdsk/device
Example:
# fsck F ufs /dev/rdsk/c0t5d0s0
4. Mount the root file system
# mount F type /dev/dsk/device /mnt
5. Save your current password file
# cp /mnt/etc/passwd /mnt/etc/oldpasswd
6. Determine if /mnt/etc/opasswd exists
# ls opasswd
If it does then copy it
# cp /mnt/etc/opasswd /mnt/etc/passwd
If it doesn’t exist then copy this file from the maintenance diskette
# cp /etc/passwd /mnt/etc/passwd
7. Edit the root password (remove it or set it to an ‘x’, see 58. above)
8. CTRLD to exit the maintenance file system.
9. If you copied opasswd from your directory then you must remove encrypted passwords for users having newer
passwords. If you copied opasswd from the maintenance diskette then you will have to recover /etc/passwd from a recent
backup or add all the users back manually (this opasswd is only a skeleton file).
106. Recover /etc/shadow: (CLI Ch. 3)
1. Boot from the maintenace diskette.
2. Find the root file system nodes (these are the device nodes that show up)
# ls l /dev/rdsk/*
3. fsck on the root file system
# fsck F fstyp /dev/rdsk/device
Example:
# fsck F ufs /dev/rdsk/c0t5d0s0
4. Mount the root file system
# mount F type /dev/dsk/device /mnt
5. Save the old shadow file
# cp /mnt/etc/shadow /mnt/etc/oldshadow
6. Create a new shadow file with a root entry like
root : : : : : : : : (you must have eight columns with eight colons)
7. Check /mnt/etc/passwd and make sure that root has no password or that it is an ‘x’.
8. CTRLD from the maintenance diskette.
9. Login as root to the system.
10. Copy the oshadow file
# cp /etc/oshadow /etc/shadow
If there is no oshadow file you must do one of three things
1. Recover /etc/shadow from a backup.
2. Reedit your newly created one and add the entries you require.
3. Run 'pwconv', This command creates entries with locked passwords. You must remove the lock (an ‘x’) before anyone
can use the logins.
107. Recover sector zero: (AT Ch.3)
1. Test sector zero:
# fdisk /dev/rdsk/device_name
2. If sector zero is missing or corrupted you will get an error message. If so, then you must boot from floppy diskette and
mount the maintenance diskette.
3. Partition the disk with fdisk:
# fdisk /dev/rdsk/device_name
4.Run fdisk again to check it:
# fdisk /dev/rdsk/device_name
5. Exit the maintenance diskette:
# cd /
# mount
# umount /mnt
# sync
CTRLD
108. Recover the boot loader: (AT Ch. 3)
You will usually get a message saying 'missing operating system'.
Do the following steps:
1. Boot from the floppy diskettes.
2. Mount the maintenance diskette.
3. Determine the root file system:
# ls l /dev/rdsk/*
4. Check the root file system:
# /install/etc/fs/ufs/fsck /dev/rdsk/device_name (can also be an s5 file system)
5. Mount the root file system:
# mount F ufs /dev/dsk/device_name /mnt
6. Run dklayout:
# cd /
# umount /mnt
# dklayout d /dev/rdsk/device_name B /mnt/etc/boot b
# sync (update the superblock)
B = copies /mnt/etc/boot to the maintenance file system.
b = writes /etc/boot program from the maintenance file system to the disk.
Note: The device must not be mounted because dklayout must be able to open it for exclusive use. If it is mounted you will
get an error 'can not open device'.
7. Exit the maintenance file system:
# cd /
# mount
# umount /mnt
# sync
109. Set up an alternate superblock:
In the event of a corrupted super block the system will return a message advising you to run fsck with
the b option. The syntax is:
# fsck F ufs o b=32 /dev/rdsk/device
Block 32 is always an alternate superblock. If 32 is also corrupted another alternate superblock may be found by running
mkfs:
# mkfs F oN /dev/dsk/device size
oN = display the file system information, do not create a new file system
size = slice size
You can find the size by running:
# prtvtoc /dev/rdsk/device
To check the file system once it is repaired use the fstyp command:
# fstyp v /dev/dsk/device
110. Recover files in /stand: (AT Ch. 3)
There are five files in /stand:
unix an ELF executable, there may be a copy saved in /etc/conf/cf.d
boot an ASCII file, there is a copy in /etc/default on the device and on the maintenance disk
at386 an ELF executable, there is a copy in /etc/initprog on the device and the maintenance
disk
att this file is not required, do not recover it if it is missing ot corrupted
compaq this file is not required, do not recover it if it is missing or corrupted
Follow these procedures:
1. Mount the maintenance floopy.
2. Find the root file system:
# cd /dev/dsk/
# echo *
3. Check the root file system:
# /install/etc/fs/ufs/fsck /dev/dsk/device_name (can also be an s5 file system)
4. Mount the root file system:
# mount F ufs /dev/dsk/device_name /mnt (can also be an s5 file system)
5. Check and repair /stand:
# /install/etc/fs/bfs/fsck /dev/dsk/device_name
6. Create a new directory and mount /stand:
# mkdir mnt1
# mount F bfs /dev/dsk/device_name /mnt1
7. Copy the files from the root file system to the mounted bfs file system you just created:
# cp /mnt/etc/default/boot /mnt1/boot
# cp /etc/initprog/at386 /mnt1/at386
<or>
# cp /mnt/etc/initprog/at386 /mnt/at386
8. Exit the maintenance file system:
# cd /
# mount
# umount /mnt
# umount /mnt1
# sync
# sync
CTRLD
111. Recover unix in /stand: (AT Ch. 3)
1. Mount the maintenance floppy disk:
2. Find the root file system:
# cd /dev/dsk
# echo *
3. Check the root file system:
# /install/etc/fs/ufs/fsck /dev/dsk/device_name (can also be an s5 file system)
4. Mount the root file system:
# mount F ufs /dev/dsk/device_name /mnt
5. Make sure that the /stand/unix file system is not corrupted:
# /install/etc/fs/bfs/fsck /dev/rdsk/device_name
6. Mount /stand:
# mkdir mnt1
# mount F bfs /dev/dsk/device_name /mnt1
7. Change to the mounted root file system:
# cd /mnt
8. Copy a valid unix into /stand:
If there is a valid copy in the root file system
# cp /mnt/etc/conf/cf.d/unix /mnt1/unix
# sync
If there is not a valid copy in root then use /etc/conf/cf.d/.unix.base
# cp /mnt/etc/cf.d/.unix.base /mnt1/unix
# sync
If .unix.base is not valid then use unix from the maintenance floppy diskette
# cp unix /mnt1/unix
# sync
Note: You must edit /stand/boot and put in the entry 'rootdev=SCSI(97)' to be able to boot using the maintenace kernel.
9. Exit the maintenance file system:
# mount
# umount /mnt
# umount /mnt1
# sync
CTRLD
112. Recover from an install tape: (AT Ch.3 and Ch. 6)
1. Login as root.
2. Insert the BASE file tapes and change to the root directory:
# cd /
3. Transfer the BASE to a temporary file:
# mkdir /tmp/base
# pkgtrans d /dev/rmt/device_name /tmp/base BASE
4. Copy the desired files to the proper directory:
Example:
# cp /tmp/base/etc/conf/bin/idbuild /etc/conf/bin/idbuild
5. When you are done remove the BASE files from your temporary directory:
# rm r /tmp/base
6. Use 'ls l' to check the permissions, ownership, etc. of the recovered files.
113. Format fixed or removable devices: (Ch. 11 BT)
# format /dev/rdsk/f03ht (format a floppy diskette)
# dkformat d /dev/rdsk/device_name (format a hard drive)
114. Mark bad blocks: (Ch. 7 CLI)
Check in /etc/errpts/SCSI_errpt for errors (streams error logs)
Errors are in the format: BAD BLOCK FOUND AT 0xyyy.
To mark:
# dkformat d /dev/rdsk/device_name v m u
v = verbose
m = maintenance mode only
u = prompts you for the block numbers
115. Manage/Display bad blocks: (Ch. 7 CLI, Ch. 11 BT)
# badlist d /dev/rdsk/device_name
116. Add a disk: (TEC book Unix Sysadm section, BT Ch. 11, diskadd, mkfs, dkformat, fdisk,
dklayout, prtvtoc, edvtoc, mknod, Jarvis notes)
(From John Anderson)
To add a 2GB disk tp an AP internal shared bus. This would be in one of two positions that normally contain an 8mm tape.
Procedure:
1. Select one AP from where the disk will be set up.
2. Install the disk drive in either c1t5 or c1t6 and reboot the selected AP. This will remove any old device information from
memory and will set new node information for the disk.
3. Format if needed:
# dkformat d /dev/rdsk/c1txd0s0
4. Create a Unix partition:
# fdisk /dev/rdsk/c1txd0s0
5. Initialize the Unix partition:
# dklayout b v p d /dev/rdsk/c1txd0s0
6. Read existing slice information into a temporary file:
# prtvtoc f /tmp/slices /dev/rdsk/c1txd0s0
7. Edit the file to slice as desired:
# vi /tmp/slices
8. Write the new slice information to disk:
# edvtoc f /tmp/slices /dev/rdsk/c1txd0s0
9. Create the new file system:
# mkfs F FSTyp free=n /dev/rdsk/device number_of_blocks
Example:
# mkfs F ufs o free=5 /dev/rdsk/c1txd0s1 100000
(free=5 is to issue a warning when you are down to 5% of free space, get the number of blocks that you enter here from the
related slice in prtvtoc).
10. The other AP sharing the drive must then be rebooted before it will recognize the drive.
117. Create a UNIX disk: (TEC book Unix Sysadm section, BT Ch. 11, diskadd, mkfs,
dkformat, fdisk, dklayout, prtvtoc, edvtoc, mknod, Jarvis notes)
Use these commands:
1. Make a device node for the disk mknod | | diskadd |
2. Format the disk dkformat | | | |
3. Partition the disk fdisk | | | |
4. Initialize the disk dklayout | | | |
5. Slice the disk prtvtoc/edvtoc | disksetup | | |
6. Make device nodes for the slices mknod | | | | |
7. Make file systems mkfs | | | | |
8. Mount file systems mount | | | | |
9. Edit /etc/vfstab vi | | |
10. Reboot the system init 6
1. Make the device node for the disk:
# mknod /device b | c major minor
Example:
# mknod /dev/rdsk/c0t5d0s0 c 35 80 (16 * t + slice)
2. Format the new disk:
# dkformat d device [c#] [u | u filename ] [m] [g] [v]
Example:
# /usr/sbin/dkformat v d /dev/rdsk/c0t5d0s0
3. Partition the new disk:
# fdisk device
Example:
# /sbin/fdisk /dev/rdsk/c0t5d0s0
4. Initialize the new disk:
# dklayout [b] [f filename] [v] [p] d device
Example:
# /usr/sbin/dklayout pbvd /dev/rdsk/c0t5d0s0
5. Slice the new disk:
Use a copy of a vtoc file as a guide and create a file, type in information (there are possible examples in some of the
manuals).
<or>
Copy a vtoc off of another disk and edit it. Then write it back to the new disk instead:
# /sbin/prtvtoc f /filename /dev/rdsk/c0t6d0s0 (copy to a file)
# vi filename (edit the vtoc structure)
# /sbin/edvtoc f filename /dev/rdsk/c0t5d0s0 (write file to the new disk)
6. Make device nodes for the slices:
# /sbin/mknod /dev/rdsk/c0t5d0sn
7. Make the file systems:
You must have at least these three file systems
boot, root, and stand.
Examples:
# /sbin/mkfs F bfs /dev/rdsk/c0t5d0s7 (boot)
# /sbin/mkfs F ufs /dev/rdsk/c0t5d0s1 (root) (or it can be an s5 file system)
# /sbin/mkfs F bfs /dev/rdsk/c0t5d0s0 (stand)
8. Mount the file systems:
# /sbin/mount F FSTyp /dev/dsk/c0t5d0sn
9. Edit the vfstab file:
# vi /etc/vfstab
10. Reboot the system:
# init 6
118. Write boot code and initialize disks: (Ch. 7 CLI)
Use this on a formatted and partitioned disk.
# dklayout b p v d /dev/rdsk/device_name
b = write the boot code.
p = intialize physical device information.
v = initialize the Volume Table of Contents (vtoc).
d = the SCSI device.
Example:
# dklayout b p v d /dev/rdsk/c0t5d0s0
119. Setup an alternate boot disk: (Ch.1 CLI)
This procedure uses root mirroring. The primary disk is /dev/dsk/c0t6d0s0 and the secondary disk is /dev/dsk/c0t5d0s0.
1. Format the disk to be identical to the boot disk.
Partition the disk to be identical to the boot disk.
Slice the disk to be identical to the boot disk.
2. Write the boot program into blocks 128 of the boot slice (7):
# dklayout b f /etc/boot d /dev/rdsk/c0t5d0s0
3. Since the two disks are to be identical in make and slicing you can copy the whole disk:
# dd if=/dev/rdsk/c0t6d0s0 bs=200k of=/dev/rdsk/c0t5d0s0
Note: If the two disks are not to be identical you must copy each slice individually:
# dd if=/dev/rdsk/c0t6d0sn bs=200k of=/dev/rdsk/c0t5d0sn
4. Make sure that the vtoc has matching tags for the slices:
For Example:
Slice 1 is of type root:
# prtvtoc f filename1 /dev/dsk/c0t6d0s0
# prtvtoc f filename2 /dev/dsk/c0t5d0s0
Now compare the files of the vtoc structures.
Use vi to change any entries.
Once they are correct write them back:
# edvtoc f filename1 /dev/dsk/c0t6d0s0
# edvtoc f filename2 /dev/dsk/c0t5d0s0
5. Check the filesystems on the alternate boot device:
# fsck F FSTyp /dev/rdsk/c0t5d0sn
Example:
# fsck F bfs /dev/rdsk/c0t5d0sa
6. Note the major and minor numbers for the root and swap slices of the alternate disk:
# ls l /dev/dsk/c0t5d0s1
# ls l /dev/dsk/c0t5d0s2
7. Create a /stand/boot file for the alternate disk:
# cp /stand/boot /stand/boot2
Edit the file boot2 so that it has the following entries:
rootdev=SCSI(X,0)
swapdev=SCSI(Y,0)
X = the minor number for slice 1 (root)
Y = then minor number for slice 2 (swap)
8. Create an appropriate /etc/vfstab file for the alternate disk:
# cp /etc/vfstab etc/vfstab2
Correct any entries in the file vfstab2 for any file systems usually mounted on the root disk:
For Example:
This entry
/dev/dsk/c0t6d0sa /dev/rdsk/c0t6d0sa /stand bfs 1 yes
Changes to
/dev/dsk/c0t5d0sa /dev/rdsk/c0t5d0sa /stand bfs 1 yes
Now they will mount on the alternate disk properly .
9. Mount the root and /stand file systems of the alternate boot disk:
# mount F ufs /dev/dsk/c0t5d0s1 /mnt (can also be an s5 file system)
# mount F bfs /dev/dsk/c0t5d0sa /mnt/stand
10. Copy the edited files to the alternate boot disk:
# cp /etc/vfstab2 /mnt/etc/vfstab
# cp /stand/boot2 /mnt/stand/boot
11. Create the correct block and character device nodes for root and rroot:
# cd /mnt/dev
# rm root rroot
# ln /mnt/dev/dsk/c0t5d0s1 /mnt/dev/root
# ln /mnt/dev/rdsk/c0t5d0s1 /mnt/dev/rroot
If the swap slice is residing on the root disk, create the correct block and character devices for swap and rswap:
# cd /mnt/dev
# rm swap rswap
# ln /mnt/dev/dsk/c0t5d0s2 /mnt/dev/swap
# ln /mnt/dev/rdsk/c0t5d0s2 /mnt/dev/rswap
12. Unmount the file systems of the alternate boot disk:
# cd /
# umount /mnt/stand
# umount /mnt
13. Repeat steps 35 and 812 above after data or configuration changes are made to the primary boot disk to ensure the
alternate boot disk contains the most recent data. You can easily create a shell script to do this and have cron run it on some
interval.
Note: Always do Step 13 before updating or installing software.
120. Booting from the alternate boot disk: (Ch. 1 CLI)
On a Uniprocessor system
1. Shutdown the primary boot disk:
# shutdown y i0 g0
2. Power off the system.
3. If the primary boot device is external power it off but don't disconnect it from the SCSI bus. Once the system is booted it
can be powered on and accessed.
<or>
If the primary boot device is an internal device remove it from the cabinet.
4. Power on the system.
On a Multiprocessor system
1. Set up the primary and alternate boot devices using this command:
# setboot p u /dev/rdsk/c0t6d0s0
# setboot s u /dev/rdsk/c0t5d0s0
<or>
Use the SUS menus to do what these commands do.
The system will now automatically boot from the secondary device if the primary device fails.
Note: You can test the alternate boot device by setting it as the primary boot device and rebooting:
# setboot p u /dev/rdsk/c0t5d0s0
# shutdown y i6 g0
121. Telnet to a site:
# telnet [ e<echar> ] [ 8 ] hostname [port]
Examples:
# telnet app0010
<or>
# telnet 153.64.110.12
122. FTP to a site:
# ftp [d] [g] [i] [n] [t] [v] [host [port]]
Examples:
# ftp app0010
<or>
# ftp 153.64.110.12
123. Free a port:
# free_port p processor
Example:
# list_procs (see if the port is free)
# free_port p app0010 (free the port if it was not displayed by the previous command)
124. Get a port:
# get_port p processor [i request_id]
Example:
# get_port p app0010
returns:
/dev/dim001/port07
125. Cu to a system:
# cu [ options ] [ destination ]
Example:
# cu l /dev/dim001/port07 (connect to a port)
126. Use of rlogin: (man rlogin)
Remote login provides interactive access to remote hosts. It's function is smilar to telnet. You can eliminate this command
by editing the /etc/inetd.conf file. You can edit the /etc/hosts.equiv and .rhosts files to provide security for this command.
To hook up to a remote system as if it were local:
# rlogin remote_host [ec] [8] [l login]
Example:
# rlogin v55_host_australia
Rlogin attempts to login without a password or username.
l = means specify an alternate login account on the remote host.
e = select an alternate escape character.
8 = enable the transmission of 8bit data.
To end the session and terminate type CTRLD or use the rlogin escape character followed by a '.' (period.) To suspend
rlogin and spawn a local shell, enter the rlogin escape character followed by a 'z'. When you exit the local shell it will
resume with your rlogin connection.
127. Start and Stop TCPIP: (TCPIP books, workbooks, man tcp)
To start TCPIP:
# /etc/init.d/win start
<or>
# cd /opt/net/tcpip/script
# tcpstart
To stop TCPIP:
# /etc/init.d/win stop
<or>
# cd /opt/net/tcpip/script
# tcpstop
128. Install TCPIP: (TCPIP books, workbooks, man tcp)
1. Connect to the AP using tty connect.
2. Bring system to singleuser mode:
# init 1
3. Relink the kernel to confirm that there are no preexisting conditions:
# /etc/conf/bin/idbuild # (the '#' option lets you monitor the relink)
If there is a problem with the relink then you must resolve it before continuing.
4. Save the TCPIP configuration files in case there is a problem:
# mkdir /tcpip_config
# cd /etc
# cp hosts networks gateways* netconfig /tcpip_config
# cd /usr/etc
# cp inetinit.cf /tcpip_config
# cd /opt/net/tcpip/etc
# cp subnet.mask /tcpip_config
5. If you have multiple interface boards, confirm what the IRQ value and IP address is for each interface:
# ildconfig ,show how many interface boards are installed.
SLOT PPA ID MAC RATE DESC IO IRQ MEM ARB NOTE
2 0 up @61c8 csma/cd 10 WD 8013EP/A 0800 10 000c0000 0000c500644
4 1 up @61c8 csma/cd 10 WD 8013EP/A 1800 10 000c4000 0000c0d7a46
# /usr/etc/ifconfig en0 ,show the IP address and subnet mask of each board.
en0: flags=3<UP,BROADCAST>
inet 128.2.1.1 netmask ffff0000 broadcast 128.2.255.255
# /usr/etc/ifconfig en1
en1: flags=3<UP,BROADCAST>
inet 132.242.1.1 netmask ffff0000 broadcast 132.242.255.255
6. Use pkgrm to remove WINTCP first and then ild since WINTCP is dependent on ild being present:
# pkgrm WINTCP
# pkgrm ild
(You don't need to rebuild the kernel until after you reinstall the packages)
7. Copy /etc/.relid and then remove all the lines except the line that identifies the release. After the ild is installed copy
back the original /etc/.relid file:
# cd /etc
# cp .relid .relid.orig
# pkgadd ild ,asks you for the IRQ level you gathered for the ethernet boards.
# pkgadd WINTCP
# cd /etc
# cp .relid.org .relid
8. Now do an idbuild and reboot the system:
# /etc/conf/bin/idbuild #
# cd /
# shutdown i6 y g0
(Don't forget to close the TTY window)
9. After rebooting, WINTCP will ask you if you want to use the saved config files. Answer yes and let it default through.
Be sure that you don't configure a SLIP interface. Configuring SLIP will confuse the AP.
10. After you login, use /usr/etc/ifconfig on each interface to confirm that the correct address is loaded on each board.
129. TCPIP information: (TCPIP books, workbooks, man tcp)
TCPIP starts these daemons by default:
tlid ,configuration file is /usr/etc/tlid.conf.
rwhod , configuration file is /usr/etc/inetd.conf.
inetd , configuration file is opt/net/tcpip/log/sndcf.log (log file).
sndcfd , configuration file is /usr/spool/rwho (data files are kept here).
Some network files:
/etc/networks ,network names, numbers, and aliases to which the current host has a
connection. The IP uses this to determine which network a packet should
be routed to.
/etc/hosts ,host names, aliases, internet addresses of remote hosts. Networking
applications refer to this file to find addresses of hosts.
/etc/conf/pack.d/arp/space.c
/etc/ftpusers ,where denied ftp users names are kept, ftp server searches it at a login
attempt.
/etc/hosts.equiv ,holds equivalent remote hosts names. Used to authenticate a request for login
coming from a user on a remote machine. Equivalent hosts are hosts with which
the local host has user accounts.
$HOME/.netrc ,enables a user to login automatically to a remote system as an ftp user. Kept in
the user's home directory.
/etc/protocols ,used by IP to determine which higher level protocol packets should be sent. IP
gets a protocol number and finds the corresponding protocol.
/etc/services ,list which transport protocol and standard port number each user level
service uses.
$HOME/.rhosts ,a users private version of /etc/hosts.equiv, it is used by the same servers.
Located in the users home directory.
/etc/gateways.eth (networks and gateways)
/etc/gateways.ynet
/etc/netconfig (can get corrupt if init 6 and modem won't work)
/etc/rc2.d (win scripts)
/usr/etc/inetinit.cf (builds win/tcp stream drivers. host ids must match host file ids)
/etc/ethers (host name and ethernet address)
/.rhosts (lists who can log on)
/opt/net/tcpip/etc (directory with duplicate communications files)
/opt/net/tcpip/etc/dlconfig (list of adapters at last config time)
/opt/net/tcpip/etc/subnet.mask (subnet mask for local machine)
Commands:
status ,give the status of your connection.
strstat ,get streams statistics.
nslookup ,information about hosts, allows you to connect and ask for information.
ruptime ,display the list of hosts you can access.
exit ,quit.
talk user_name ,gives a full screen interactive session with another user.
ps ea ,see the running processes.
ps an ,see addresses and UDP ports assigned (requires an argument).
finger ,gives information about who is on the system and idle time.
ping ,to tell if a system is on the network.
netstat in ,see information about interface names.
netstat a ,list active/inactive transport endpoints (gateway routes).
netstat rn ,view routing tables.
# netstat -r ,displays the status and contents of the routing tables.
netstat i ,view current network interfaces.
netstat A ,display all current connections to remote hosts.
netstat s | pg ,display error statistics for ip, icmp, tcp, and udp protocols.
/usr/etc/arpbypass a ,view the arp table.
/usr/etc/ifconfig en0 ,show the configuration of en0.
/usr/etc/ifconfig en0 up ,bring up en0 interface.
/usr/etc/ifconfig en0 down ,bring down en0 interface.
setuname s app0011 (if uname is wrong)
setuname n app0011
<or>
./install/changeNodeName app app0010
traceroute (at the unix prompt: see what this does)
TLID/TRUSS (to show system calls that process is making. can trace what it is doing)
/usr/etc/tlid (location of tlid file)
ps eaf | grep tlid (TCP daemon: starts telnet services)
truss p 611 > /tmp/tlid.tmp & (611 is pid of tlid)
truss ls (can truss any command)
truss ef p <pid>
dir nu (to see who is in shell and their permissions)
pwd (to see current directory /usr/acct/jarvisn)
machinetype (gives processor information)
pinfo (to see processor and if online)
online (puts processors online)
offline (puts processors offline
who b (shows when booted last)
who r (to see if in init 1 mode)
who u
who (to see who is logged on)
who am i (to see me)
who > file (puts those whoe are logged on into file)
who >> file (appends what is in file)
who q (to see users and number of users)
whodo (to see who is logged on and other info)
rwho (to see who is on network)
rwho a
Procedures:
Check this file for locks on your port: /var/spool/locks
Gateways route data based on destination network, not on destination host.
Dim ports are listed in /etc/uucp/Devices.
Default network file templates are kept in: /opt/net/tcpip/etc
Private network ethernet board must be in slot before public network
Make sure ethernet cable connected.
Make sure dbl load ran when booted.
Run adfmenu if install new ethernet board.
If aws and app0010_e works, lan is working (ethernet)
If can't connect to ap by lan from aws window, ynet is not working. Or, if can't telnet aws and app0010, ynet isn't
working.
Make sure entry in gateway.eth not commented out on aws.
Use defaults on node records if don't dbl load won't happen and network files won't be updated and you won't be able to
connect.
When rm/opt/net/tcpip/etc/dlconfig is removed and you do not want to configure one of the ethernet cards, answer "n" at
question; however, everytime you reboot, you will have to go through win/tcp config.
# pg /usr/etc/inetinit.cf (check to see if correct # of cards are uncommented; if not, then rm dlconfig)
# /etc/ildconfig
(The /etc/ildconfig command is used to determine the status (up, down, or bad) for each ethernet card configured in the
system. When the /etc/rc2.d/S60win script runs during the change to run level 3, it executes an ildconfig command and
compares the results to the /opt/net/tcpip/etc/dlconfig file. If differences are detected you will be prompted to reconfigure
the network)
SLOT PPA ST ID MAC RATE DESC IO IRQ MEM ARB NODE
7 0 up @61c8 csma/cd 10 WD 8013EP/A 0800 3 000c8000 0000c0289a09
8 1 up @61c8 csma/cd 10 WD 8013EP/A 1800 3 000cc000 0000c014a109
The ARB NODE values read off ethernet card - the numbers are unique - if no numbers, then something wrong with
ethernet card.
ST must be marked up - if one is down then ARP_NDEV probably not configured correctly in mtune file (2*no of cards
+2)
000cc000 make sure the MEM field has shadow disabled in adf
The IO addresses are used to make sure shadow is disabled do this by: ADFMENU, VIEW
# /usr/etc/route add net default 192.127.30l254 1 (This updates the network routing table - seen when
you do netstat -rn)
When the AP performs start of day, a script is run which adds site specific routes to the
routing table. This file can be found in:
/etc/gateways.eth
The entries for the router (as referenced above) are made using the appropriate commands specific
to the type of router being used. can execute this from # prompt; then don't have to take network
down.
# /usr/etc/route add net default 192.127.30l.254 1 (default is ip address; 192.127.301.254 is router
address)
# netstat -i
(The netstat -i command shows the status of the network interfaces)
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
en0 1492 enet app001-1_e 1326 0 1225 0
en1 1492 host2_1-stg3_ne host2_1-stg3 26543 0 1745 0
lo0 4096 Loopback me 12 0 10 0
dlyn 32708 ynet app001-1 136 0 134 0
# netstat -r (routing tables - routes established)
The netstat -r displays the status and contents of the routing tables.
Routing tables
Destination Gateway Flags Refcnt Use Interface
host2_1-stg3_net host2_1-stg3 U 0 1795 en1
ynet app001-1 U 0 134 dlyn
enet app001-1_e U 0 1225 en0
me me UH 0 10 lo0
# netstat -in
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
en0 1492 128.164 128.164.1.9 9981 0 8882 0
en1 1492 160.110.112 160.110.112.12 120230 0 86244 0
lo0 4096 127 127.0.0.1 32 0 30 0
dlyn 32708 128.165 128.165.192.9 2927833 0 3051114 0
# netstat -rn
Routing tables
Destination Gateway Flags Refcnt Use Interface
160.110.112 160.110.112.12 U 0 74307 en1
128.165 128.165.192.9 U 0 3051261 dlyn
128.164 128.164.1.9 U 0 6961 en0
default 160.110.112.1 UG 0 10017 en1
127.0.0.1 127.0.0.1 UH 0 30 lo0
# pg /etc/ildcf
Does the number of entries match the number of ethernet cards? If not, or
If have entry for token ring board, then it is wrong so,
# mv /etc/ild/ildcf /etc/eld/ildcf.old
then restart ild
# cd /etc/init.d
# ./ild start (will rebuild file)
# crash
dumpfile = /dev/mem, namelist = /stand/unix, outfile = stdout
0> od -x wdparams 4
e06b284c: 00000001 00000800 000c8000 00004000
(The number should match the ildconfig configuration)
0> od tcpd_cnt
0> od so_cnt (socket count)
0> od x wdparams 4
e06699a8: 00000001 00000800 000c0000 00004000
(000c0000 should match value under MEM in ildconfig)
To reconfigure TCPIP:
# rm /opt/net/tcpip/etc/dlconfig (when removed, forces you through reconfig - for ethernet only)
# init 6 (will then go through configuration)
Run these to know that the TCPIP install is okay:
# telnet me
# netstat i
You can send to all nodes on a network by specifying n.n.0.0:
Example:
128.242.0.0
To reset a port:
# /opt/csf/bin/csfport r
Trace your attempt to connect to a port:
# cu d l
To get out after you tty connected:
~ . . (tilda, dot, dot)
To get out of runaway bleeping binary telnets:
~ . =(one level)
~ ~ . =(two levels)
(~ = one hop)
(. = disconnect)
Ethernet board adapter:
/etc/conf/cf.d/mtune ( will see ARP_NDEV 6 (this number is calculated:
# of adaptors x 2 + 2) (so the 6 means only 2 ethernet cards
per ap)(if you want more than 2 ethernet cards, must change
this number). Then rebuild kernel. You may also need to
to increase IP_NLINK= 16 or greater)
To isolate where the connection fails:
# /usr/etc/ping host_name
Example:
# ping me
(Ping the local host first, then hosts and gateways farther away)
Process to do a strace:
# cd /
# /opt/net/tcpip/bin/didle do_strlog 1
# /opt/net/tcpip/bin/didle tcp_debugmask 1
# strace > /tmp/tcp.tr &
number appears; use this number to kill this
In this example the tcp layer will be traced and it's output will be redirected to the /tmp/tcp.tr file. The trace should be ran
in the background.
2. To stop the tracing kill the process. Do not use the 9 option
with kill. The network should be as quiescent as possible and the
trace should be ran for only a short time.
# kill <pid>
3. Set the fields back to their original values.
Example:
do these in this order
$ /opt/net/tcpip/bin/didle tcp_debugmask 3 (set to 3 to put warnings
in streams error log; otherwise
only fatal errors go there)
$ /opt/net/tcpip/bin/didle do_strlog 0
The current setting of the fields, with the exception of the
do_strlog field, can be viewed by entering the
/opt/net/tcpip/bin/didle command without arguments.
Process to capture transmission frames for use in diagnosing network problems:
1. Use the following command to start data capture on an adapter.
# /etc/ild/dcap p s (size) P (ppa) o (outfile) &
Note: This command must be ran in the background.
Options:
p Promiscuous mode. Capture all frames. Recommended.
s (size) Maximum number of frames to be written to the output
file. The output file is circular and once this value is exceed
ed, the oldest frames will be removed. Range 1 10000. Default
is 1000.
P (ppa) The physical position of the adapter. The relates to the
"en?" value displayed with the netstat i command. Enter 000 for
en0, 001 for en1, etc...; if use P use 0 for the size
o (outfile) The name of the file to write the data capture
frames to.
2. To stop the data capture, kill the process. Do not use the 9 option. The following parser process will fail if the dcap
process was killed with the 9 option.
# kill xxxx
3. Since the data capture file is circular you must use the parser command to make it meaningful. Enter the following
command to parse the data capture file.
# /etc/ild/parser hs i (infile) o (outfile)
Options:
h Print a hex dump of each frame.
s Print a summary line of each frame.
i (file) The name of the data capture file.
o (file) The name of the output fil
k Print the output in keyword=value format. Not supported.
t (tracefile) Name of the file to write error messages to.
v (verbose_level) Specifies the level of verbose
messages to p 7 3
print. Not supported.
Example:
# /etcld/parser hs i /tmp/ildcap o parsed.cap
Options:ld/parsernhsoia(infile)ro (outfile)capture file.
4. Then vi on outfile; search on SYN read to see where telnet went.
Process for setting up IP addresses to ClassC:
To set ynet at 193:
cab * 8 + processor = TPN (160.109.192.0; 192 is TPN; 0256,256 is the limit)
1*8+0=8
8/256+192=192 (third digit)
change node record, edit host, networks file and reboot.
When 255.255.255.0 mask was used at PEROT the following script was changed to allow for class b ynet addressing:
# /etc/rc2.d/s68yservices
this line was changed:
/usr/etc/ifconfig dlyn broadcast $network .255 netmask 255.255.255.0
Network initialization fails:
Are the cards up? Check the status file "ST" from the ildconfig command. The cards must be marked UP for every
interface in the inetinit.cf file.
Check ARP_NDEV entry in mtune. If more than 2 ethernet cards, must increase this value.
Are the entries in /usr/etc/inetinit.cf correct? Are there matching entries in /etc/hosts for each interface name? Are all
of the other fields correct? Will see messaage "can't link" if not correct
Cannot communicate between direct connected nodes:
Is the ethernet lan terminated on both ends? Is the cable damaged?
Are the interupt levels defined properly for the given Unix kernel? Check CMOS with reference disk or ildconfig
command (IRQ 10 for the AWS & IRQ 3 for APs)
Are the lan cables connected to the correct cards? Cards are initialized in order as defined in /usr/etc/inetinit.cf (i.e.
the first entry in the file initializes the card in the lowest numbered slot (on mca) the next entry intializes the next
lowest slot etc)
could be you might have to move from slot 7 to slot 8 in one of the aps. it will work if using slot 7 in one ap and slot 8
in another ap.
Is the network portion of the IP address the same on both nodes? Multiple logical networks can be run on the same
physical media, but only nodes that are defined to be on the same logical network (i.e. the network portion of their IP
addresses is the same) can communicate with each other.
Check the /etc/init.tab file.
Cannot communicate across different networks:
Are routes established? Check netstat r(n). Do the nodes on each network have a route defined to the
other network?
Make sure routed.ynet daemon is running on aws and any ap nongateway ap (those not having a private
ethernet connection) A symptom of this is when can't connect over the lan but you can by tty.
# ps ef | grep routed
# /usr/etc/routed.ynet (to start it if it is not running)
Check cabling; if one ping works and the other doesn't, try switching cables and ping again
If can telnet out of AP but not in; verify that the file /usr/etc/tlid.conf exists. If not:
# cp /opt/net/tcpip/etc/til.conf /usr/etc/tlid.conf
Make sure tli daemon is running on the AP (tlid) a symptom that this isn’t running is if you can ping
and rlogin but can't telnet.
# ps ef | grep tlid (if not running, start it)
# /usr/etc/tlid (don't need to execute in background)
(if it isn't there, copy it from another host)
# uname (make sure correct)
# rlogin (your own resources)
# te lnet (the other ap's resources)
Files to look at: .osm, console.log
Can't ping self but can telnet and everything else is ok
check /etc/netconfig (make sure not corrupt)
change /etc/conf/pack.d/arp/space.c file
arp_loopback = 1
If can't logon to a system as root
put '#' in front of console in /dev/console.
Control socket 0 invalid argument/ corrupt netconfig file:
1. A concise sequence of events leading up to the problem are described.
2. A copy of the corrupted netconfig file is supplied.
This problem is usually detected 'some time' after its occurrence (eg a week later). If it does occur, the following
diagnostic will be helpful
1. Change /etc/rc2.d/S60win, line 33
existing line: TMPERR=/tmp/${WIN}.err
change it to : TMPERR=$TCPIPLOG/winerr.$$
2. Monitor the system for the next occurrence of the problem. This would entail checking /etc/netconfig each time the
system is rebooted.
3. In the event of a corrupted netconfig file, record the previous sequences (each boot, whether or not it was allowed to
complete, any any other event that may assist problem determination). Then copy
/opt/net/tcpip/log/winerr.xxxx file to print. (xxxx will be either a three or four digit processid number.
This file (or files) are the error log of win initialization.
To trouble shoot the ynet:
/usr/etc/yoda
If you change ynet address, change networks file, host file and dws.config file by changing node record.
If you can't connect make sure ynet power ok
If you see message: "ynet processor does not exist"; run yoda and if it comes back
with "cannot find ynet processor number" then it is probably this problem and do the following:
make sure route.ynet deamon running; if not sure then
# /etc/init.d/ynetrouting stop
# /etc/init.d/ynetrouting start
If say yes to domain services, the dlynd daemon gets killed and you won't be able to connect to ynet.
If do netstat r and the dlynd line is missing, this can be resolved by doing the following:
kill dlynd and restart it again
If cannot connect through lan from ap to aws: make sure /usr/etc/dlynd is runing on ap.
# fuser /dev/00 (to see processes running)
130. Use of symbolic links: (man ln, workbooks)
Symbolic links are files that point to other files. Hardlinks may not span file systems and may not refer to directories.
Softlinks may span file systems, even those on different machines. Use full pathnames to avoid too many levels of
symbolic links. Links are useful in cases such as this: You have a directory that certain software must reside in but your
disk is full. But you have a free partition on another disk. You can make a symbolic link to the other disk and it will 'look
like' it belongs to your original directory thus increasing your space. Users will not notice the difference. Links can help in
ways such as this and in other ways. Links give you systemflexibility.
How to display symbolic links
# ls l
# ls l /
# ls l /bin
How to create symbolic links
# /usr/ucb/ln [fs] filename [linkname]
# /usr/ucb/ln [fs] pathname directory
Examples:
# ln s directory dir_linkname ,soft link
# ln s /var/tmp/file file_symlink
# ln file linkname ,hard link
How to remove links
# rm linkname
131. How to do a data capture:
Use the following process to capture transmission frames for use
in diagnosing network problems.
Use the following command to start data capture on an adapter.
# /etc/ild/dcap p s (size) P (ppa) o (outfile) &
Note: This command must be executed in the background.
Options:
p Promiscuous mode. Capture all frames. Recommended.
s (size) Maximum number of frames to be written to the output
file. The output file is circular and once this value is exceed
ed, the oldest frames will be removed. Range 1 10000. Default
is 1000.
P (ppa) The physical position of the adapter. The relates to the
"en?" value displayed with the netstat i command. Enter 000 for
en0, 001 for en1, etc...
o (outfile) The name of the file to write the data capture
frames to.
Example:
# /etc/ild/dcap p s 10000 P 001 o /tmp/ildcap &
To stop the data capture, kill the process. Do not use the 9
option. The following parser process will fail if the dcap proc
ess was killed with the 9 option.
Since the data capture file is circular you must use the parser
command to make it meaningful.
Enter the following command to parse the data capture file.
# /etc/ild/parser hs i (infile) o (outfile)
Options:
h Print a hex dump of each frame.
s Print a summary line of each frame.
i (file) The name of the data capture file.
o (file) The name of the output file.
k Print the output in keyword=value format. Not supported.
t (tracefile) Name of the file to write error messages to.
v (verbose_level) Specifies the level of verbose messages to
print. Not supported.
Example:
# /etcld/parser hs i /tmp/ildcap o parsed.cap
Options:ld/parsernhsoia(infile)ro (outfile)capture file.
132. How to use the script command: (man script)
This command is used to make a transcript of everything printed on your terminal:
# script [a] [filename]
a = append
If you don't give it a filename it will create one called 'typescript'. The script ends when the forked shell exits or when you
CTRLD to manually exit.
Example:
# script a /tmp/dump_file
133. How to use the didle and strace command: (man strace, notes)
Didle is used for debugging your system. It is a dangerous command because it changes memory. You can even use it to
tune a system on the fly. The following example does an strace on an rlogin process that has been failing. The Strace
command is used to print STREAMS trace messages. It is similar in usage to the truss command.
Example:
(from an rlogin problem)
1. Strace On (do on both the local and/or remote hosts)
# /opt/net/tcpip/bin/didle do_strlog 1
# /opt/net/tcpip/bin/didle tcp_debugmask 1 (set the debugmask)
# strace > filename &
2. Do the rlogin command that you want traced.
3. Now stop the strace:
# /opt/net/tcpip/bin/didle tcp_debugmask 1 (set the debugmask back)
# kill <strace process>
4. Analyze the datacaptured file.
134. How to use the spray command: (man spray)
The spray command is used to spray packets to a host. This can be used as a tool to trace various system problems. For
example, a system could be losing packets during high traffic times. You can use this command to flood a sytem with
packets to simulate heavy traffic. This can aid your analysis.
# /usr/sbin/spray [ c count ] [ d delay ] [ l length ] [ t nettype host ]
Example:
# spray c 10 appoo10
DESCRIPTION
spray sends a oneway stream of packets to host using RPC, and reports how many were received, as well as the
transfer rate. The host argument can be either a name or an Internet address. The following options are available:
c count Specify how many packets to send. The default value of count is the number of pack
ets required to make the total stream size 100000 bytes.
d delay Specify how many microseconds to pause between sending each packet. he default is 0.
l length The length parameter is the numbers of bytes in the Ethernet packet that holds the RPC
call message. Since the data is encoded using XDR, and XDR only deals with 32 bit quantities, not all
values of length are possible, and spray rounds up to the nearest possible value. When length is greater than 1514,
then the RPC call can no longer be encapsulated in one Ethernet packet, so the length field no longer has a
simple correspondence to Ethernet packet size. The default value of length is 86 bytes (the size of the RPC and UDP
headers).
t nettype Specify clas of transports. Defaults to netpath. See rpc(3N) for a description of sup
ported classes.
EXAMPLE
The following code fragment demonstrates how the spray pro
tocol is used:
#include <rpc/rpc.h>
#include <rpcsvc/spray.h>
. . .
spraycumul spray_result;
sprayarr spray_data;
char buf[100]; /* arbitrary data */
int loop = 1000;
CLIENT *clnt;
struct timeval timeout0 = {0, 0};
struct timeval timeout25 = {25, 0};
spray_data.sprayarr_len = (u_int)100;
spray_data.sprayarr_val = buf;
clnt = clnt_create("somehost", SPRAYPROG, SPRAYVERS, "netpath");
if (clnt == (CLIENT *)NULL) {
/* handle this error */
}
if (clnt_call(clnt, SPRAYPROC_CLEAR,
xdr_void, NULL, xdr_void, NULL, timeout25)) {
/* handle this error */
}
while (loop > 0) {
if (clnt_call(clnt, SPRAYPROC_SPRAY,
xdr_sprayarr, &spray_data, xdr_void, NULL, timeout0)) {
/* handle this error */
}
}
if (clnt_call(clnt, SPRAYPROC_GET,
xdr_void, NULL, xdr_spraycumul, &spray_result, timeout25)) {
/* handle this error */
}
printf("Acknowledged %ld of 1000 packets in %d secs %d usecs\n",
spray_result.counter,
spray_result.clock.sec,
spray_result.clock.usec);
135. Setup profile and .profile: (TEC book, BT Ch. 5)
The /etc/profile file is for the system in general. The .profile in a user's directory is for the individual user. There is a
default .profile for users saved in the /etc/skel directory.
Some commands:
# set (display local and global variables)
# env (display global variables)
# TERM = motifterm; export TERM (set the terminal variable)
The systems profile:
The /etc/.profile file is executed by the shell when a user logs on. It establishes setup information specific to the operating
system that all users share. The following items are typically included in /etc/.profile:
The time zone variable TZ
Depending on how the shell program is invoked
the message of the day
check for user mail
check for new news
The umask command for setting up permissions on newly created files and directories
Mesg n, prevents other users from writing to the terminal directly
Example of a system's profile file:
[begin]
###### ident "@(#)adm:profile 1.13"
trap "" 1 2 3
umask 022 # set default file creation mask
. /etc/TIMEZONE
case "$0" in
jsh | ksh | rsh | sh)
# calculate available disk space in root filesystem.
#echo "" # skip a line
#trap : 1 2 3
#. /etc/dfspace
# issue message of the day
echo "" # skip a line
#if [ s /etc/motd ] ; then cat /etc/motd; fi
if [ s /etc/motd ] ; then pg /etc/motd; fi
trap "" 1 2 3
# set default attributes for terminal
stty erase '^h' echoe
#stty rows 24
#stty columns 80
if [ x$TERM = x o "$TERM" = 'unknown' ]; then
LOGTTY=${LOGTTY:=`tty`}
TERM=ansi
if [ `expr "$LOGTTY" : '.*/\(.*\)'` = "console" ]
then
/sbin/isat386
if [ $? = 0 ]
then TERM=AT386
fi
fi
fi
if [ "$TERMCAP" = "" ]
then TERMCAP=/etc/termcap
fi
export TERM TERMCAP
# check mailbox and news bulletins
if mail e
then echo "\nyou have mail"
fi
if [ $LOGNAME != root ]
then news n
fi
;;
su)
:
;;
esac
export PATH;
trap 1 2 3
COPLIB=/usr/lib # Added by cliv2,bteq or fastld package
export COPLIB
COPERR=/usr/lib
export COPERR
PATH="$PATH:/usr/ccs/bin:/usr/etc" # Installed by package instance scde
PATH="$PATH:/usr/local/bin"
SPIROOT=/opt/spi
export SPIROOT
XHELPPATH=$XHELPPATH${XHELPPATH:+:}/opt/spi/help; export XHELPPATH
NLSPATH=$NLSPATH${NLSPATH:+:}/opt/spi/nls/%L/%N.cat; export NLSPATH
EDITOR=vi
export EDITOR
TOPENDDIR=/home2/topenddir export TOPENDDIR
TOPENDADM=/home2/topendadm export TOPENDADM
PATH=$PATH:.
PATH=$PATH:$TOPENDADM/isd:$TOPENDADM/bin:$TOPENDADM/bin/admin
PATH=$PATH:$TOPENDDIR/bin:$TOPENDDIR/bin/admin
export PATH
PATH=$PATH:/usr/bin/X11:/usr/bin/motif; export PATH
PATH="$PATH:/usr/ccs/bin" # Installed by package instance scde
NONAMESERVER=1
export NONAMESERVER
[end]
The users .profile:
After executing the system profile, the system executes the user's .profile file. A default .profile is included in the
directory /etc/skel. This was copied to the user's home directory by the 'useradd' command. The administrator can modify
the default files in the /etc/skel directory or create a separate directory which can be used instead by the 'useradd m k'
command. The main variables in your .profile are MAIL, PS1, PS2, PATH, TERM, and HOME. The default .profile file is
in /etc/skel.
HOME = The path of your home directory
PATH = The search path shell uses to find a command
PS1 = Prompt string 1. The prompt that is displayed by the shell when it is ready for input.
PS2 = Prompt string 2. This is displayed when there is a continuation of a command onto the next line
TERM = The name of the terminal. It is not used by shell but rather by other programs such as vi and
sysadm
MAIL = The directory that holds your mail files
Example of a user's .profile file:
[begin]
# This is the default standard profile provided to a user.
# They are expected to edit it to meet their own needs.
CDSTACK=20 export CDSTACK
DISPLAY="?????tv:0.0" export DISPLAY
EDITOR=vi export EDITOR
ENVFILE=$HOME/.kshrc export ENVFILE
ENV='${ENVFILE[(_$=0)+(_=1)_${%%*i*}]}' export ENV
EXINIT='set showmode';export EXINIT
FCEDIT=vi export FCEDIT
HISTFILE=/tmp/${LOGNAME}hist export HISTFILE
HISTSIZE=512 export HISTSIZE
PAGER=less export PAGER
PATH=/usr/bin:/usr/local/bin:/usr/etc:/usr/bin/vpix:/usr/ucb:. export PATH
MAIL=/usr/mail/${LOGNAME:?}
SHELL=/usr/bin/ksh export SHELL
TAGSTACK=~/.tagstack export TAGSTACK
TAGPOP=~/.tagpop export TAGPOP
# TERM=${TERM:AT386} export TERM
CVSROOT=/master.src export CVSROOT
TERM=vt100 export TERM
PS1='! $PWD> '
#umask 022
stty erase '^h' echoe kill '^_'
[end]
136. Set system passwords: : (BT Ch. 5)
# passwd user_name (even root if you have permission)
Example:
# passwd Claudia_Schiffer
137. List users: (Ch. 6 BT)
# users (a compact list of users logged on)
# who ( who is currently logged on)
# logins l name_of_login (see who has accounts on your system)
# logins u (see all users)
# logins g group_name (see who belongs to a group)
138. List groups: (Ch. 6 BT)
# logins g group_name (see who belongs to a group)
# groups [userid] (list your groups or a users groups)
Note: information on groups is in the files /etc/passwd and /etc/group.
139. List users, groups, and system login information: (BT Ch.6, workbooks,
man useradd, man groupadd)
# logins [dmopstuxa] [g groups] [l logins]
d = select logins with duplicate uids.
m = display multiple group membership.
o = format output into one line.
p = select logins with no passwords.
s = select all system passwords.
t = sort by login instead of by uid.
u = select all user logins.
x = printed extended information.
a = show the two password expiration fields also.
Example:
# logins d g root l Jedediah
140. Add, modify, and delete users: (BT Ch.6, workbooks, man useradd, man groupadd)
Add a user:
Shortcuts
# useradd m user_name (m = create the home directory)
# useradd user_name (do not create a home directory)
Full syntatic usage
# /usr/sbin/useradd [u uid [o] [g group] [G group[,group...]] [d dir] \
[s shell] [c comment] [m [k skel_dir]] [f inactive] [e expire] login
Example:
# useradd u 122 g 200 c "UserDude" d /home/ncr1 s /sbin/sh m e 03/04/95 ncr1
u = specify user ID. Default is the next available number. Range is 10060000.
g = specify group ID. Default is 'other'(1).
c = comment.
d = the home directory for this user.
s = shell program to be executed upon login. Default is /sbin/sh.
m = create the home directory as you create the user. Copy files from /etc/skel.
e = expiration date.
Modify users:
# /usr/sbin/usermod [u uid [o] [g group] [G group[,group...]] [d l] \
[c comment] [l new_logname] [f inactive] [e expire] login
Example:
# /usr/sbin/usermod u 122 g 200 c "UserDude" l SurferDude ncr1
u = new user ID.
o = allows duplication.
g = an existing groups name. Primary group membership.
G = supplementary group membership.
d = new home directory.
c = comment.
l = new name.
f = number of days allowed inactive before ID becomes invalid.
e = expiration date.
Delete a user:
# userdel login_name (only remove the user and not his home directory.)
# userdel [r] login_name (remove the user from /etc/shadow, /etc/group,
and the /etc/passwd files.)
r = remove the user's home directory and files.
Example:
# userdel r Joe
141. Add, modify, and delete groups: (BT Ch.6, workbooks, man useradd, man groupadd)
Add a group:
# groupadd [g gid] [o] group_name
g gid = group id to assign. Default is the next available number.
o = allows duplicate gid numbers.
Examples:
# groupadd g 200 student
# groupadd staff
Results of adding a group:
# tail 2 /etc/group (show last 2 entries of the /etc/group file.)
student: :200:
student: :201:
Modify a group:
# groupmod [g gid] [o] [name] group
g = group ID.
o = group ID can be nonunique.
name = new name for group.
Example:
# groupmod g 200 name students
Delete a group:
# groupdel group_name
Example:
# groupdel students
142. Display password information:
# passwd [s [login]] [a s]
Example:
# passwd s username
143. Assign or modify a password:
# passwd username (for all users other than your login)
# passwd (for your login)
Example:
# passwd Stands_With_A_Fist
144. Define defaults for adding users: (BT, sysadm, useradd)
Use SYSADM.
<or>
User default information is usually kept in a file called /usr/sadm/defadduser. Some systems may not have this file (the
information may be kept somewhere else. Use the useradd D command to set a new user to the defaults.
Use the strings command to see the fields that defaults can be saved for:
# type useradd
returns: /usr/sbin/useradd
# strings /usr/sbin/useradd | pg
returns: defgroup=
defgname=
etc...
145. Maintain shadow and password files: (Ch. 1 CLI)
For a login to be used it must have an entry in both the /etc/shadow and the /etc/passwd files.
Use the following commands to update or recreate the /etc/shadow file:
pwconv (creates/updates from entries in /etc/passwd)
passmgmt (adds, deletes, modifies information for a given user)
Password field entry relationship between both files
/etc/passwd /etc/shadow Possible login activity
X encrypted password Login with a password
X Login, no password
X X Locked login (no login allowed)
encrypted password No login permitted
Login permitted, must enter a new password
X Locked login (no login allowed)
146. Control password aging: (workbooks, see creating users)
This command changes the /etc/shadow file:
# passwd n n x n w n username
Example:
# passwd n7 x42 w7 user
n = minimum number of days
x = maximum number of days
w = warning
147. List information about port monitors and services: (man pmadm, man sacadm, Ch. 14 BT)
This command reads or modifies the corresponding /etc/port_monitor/_pmtab:
# pmadm l (display)
These commands read or modify /etc/saf/_sactab:
# sacadm l (display)
148. Configure a port monitor: (man pmadm, man sacadm, Ch. 14 BT, Happy's Sysadmin book)
General Port Monitor Information. For specifics see the item entries following this one.
pmadm port monitor administration
# pmadm a [p pmtag | t type] s svctag i id m pmspecific v ver [f xu] [y comment] [z script]
# pmadm r p pmtag s svctag
# pmadm e p pmtag s svctag
# pmadm d p pmtag s svctag
# pmadm l [t type | p pmtag] [s svctag]
# pmadm L [t type | p pmtag] [s svctag]
# pmadm g p pmtag s svctag [z script]
# pmadm g s svctag t type z script
pmadm is the administrative command for the lower level of the Service Access Facility hierarchy, that is, for service
administration. A port may have only one service associated with it although the same service may be available through
more than one port. In order to uniquely identify an instance of a service the pmadm command must identify both
the port monitor or port monitors through which the service
is available (p or t) and the service (s). See the option descriptions below.
pmadm performs the following functions:
add or remove a service
enable or disable a service
install or replace a perservice configuration script
print requested service information
Any user on the system may invoke pmadm to request service status (l or L) or to print perservice configuration
scripts (g without the z option). pmadm with other options may be executed only by a privileged user.
The options have the following meanings:
a Add a service. pmadm adds an entry for the new service to the port monitor's administrative file. Because of the
complexity of the options and arguments that follow the a option, it may be convenient to use a command script or the
menu system to add services. If you use the menu system, enter sysadm ports, then choose the port_services option.
d Disable a service. Add x to the flag field in the entry for the service svctag in the port monitor's
administrative file. This is the entry used by port monitor pmtag. See the f option, below, for a description of the
flags available.
e Enable a service. Remove x from the flag field in the entry for the service svctag in the port monitor
administrative file. This is the entry used by port monitor pmtag. See the f option, below, for a description of the
flags available.
f xu
The f option specifies one or both of the following two flags which are then included in the flag field of the entry for
the new service in the port monitor's administrative file. If the f option is not included, no flags are set and the default
conditions prevail. By default, a new service is enabled and no utmp entry is created for it. A f option without a
following argument is illegal.
x Do not enable the service svctag available through port monitor pmtag.
u Create a utmp entry for service svctag available through port monitor pmtag.
g Print, install, or replace a perservice configuration script. The g option with a p option and a s option prints the
perservice configuration script for service svctag available through port monitor pmtag. The g option with a p option,
a s option, and a z option installs the perservice configuration script contained in the file script as the perservice
configuration script for service svctag available through port monitor pmtag. The g option with a s option, a t
option, and a z option installs the file script as the perservice configuration script for service svctag available through
any port monitor of type type. Other combinations of options with g are invalid.
i id
id is the identity that is to be assigned to service svctag when it is started. id must be an entry in
/etc/passwd.
l The l option requests service information. Used by itself and with the options described below it provides a filter
for extracting information in several different groupings.
l By itself, the l option lists all services on the system.
l p pmtag
Lists all services available through port monitor pmtag.
l s svctag
Lists all services with tag svctag.
l p pmtag s svctag
Lists service svctag.
l t type
Lists all services available through port monitors of type type.
l t type s svctag
Lists all services with tag svctag available through a port monitor of type type.
Other combinations of options with l are invalid.
L The L option is identical to the l option except that output is printed in a condensed format.
m pmspecific
pmspecific is the port monitorspecific portion of the port monitor administrative file entry for the service.
p pmtag
Specifies the tag associated with the port monitor through which a service (specified as s svctag) is available.
r Remove a service. When pmadm removes a service, the entry for the service is removed from the port
monitor's administrative file.
s svctag
Specifies the service tag associated with a given service. The service tag is assigned by the system administrator
and is part of the entry for the service in the port monitor's administrative file.
t type
Specifies the the port monitor type.
v ver
Specifies the version number of the port monitor administrative file. The version number may be given as
v `pmspec V`
where pmspec is the special administrative command for port monitor pmtag. This special command is ttyadm for
ttymon and nlsadmin for listen. The version stamp of the port monitor is known by the command and is returned
when pmspec is invoked with a V option.
y comment
Associate comment with the service entry in the port monitor administrative file.
z script
Used with the g option to specify the name of the file that contains the perservice configuration script. Modifying a
configuration script is a threestep procedure. First a copy of the existing script is made (g alone). Then the copy is
edited. Finally, the opy is put in place over the existing script (g with z).
OUTPUT
If successful, pmadm will exit with a status of 0. If it If successful, pmadm will exit with a status of 0. If it fails for
any reason, it will exit with a nonzero status.
Options that request information write the requested information to the standard output. A request for
information using the l option prints column headers and aligns the information under the appropriate headings. In
this format, a missing field is indicated by a hyphen. A request for information in the condensed format using the L
option prints the information in colonseparated fields; missing fields are indicated by two successive colons. # is the
comment character.
EXAMPLES
Add a service to a port monitor with tag pmtag. Give the service the tag svctag. Port monitorspecific information is
generated by specpm. The service defined by svctag will be invoked with identity root.
pmadm a p pmtag s svctag i root m `specpm a arg1 b arg2` v `specpm V`
Add a service with service tag svctag, identity guest, and port monitorspecific information generated by specpm to all
port monitors of type type:
pmadm a s svctag i guest t type m `specpm a arg1 b arg2` v `specpm V`
Remove the service svctag from port monitor pmtag:
pmadm r p pmtag s svctag
Enable the service svctag available through port monitor pmtag:
pmadm e p pmtag s svctag
Disable the service svctag available through port monitor pmtag:
pmadm d p pmtag s svctag
List status information for all services:
pmadm l
List status information for all services available through the port monitor with tag ports:
pmadm l p ports
List the same information in condensed format:
pmadm L p ports
List status information for all services available through port monitors of type listen:
pmadm l t listen
Print the perservice configuration script associated with the service svctag available through port monitor pmtag:
pmadm g p pmtag s svctag
FILES
/etc/saf/pmtag/_config
/etc/saf/pmtag/svctag
/var/saf/pmtag/*
149. Add a port monitor: (man pmadm, man sacadm, Ch. 14 BT)
This command reads or modifies /etc/saf/_sactab:
# sacadm a
Example:
The port monitor tag is npack; its type is listen; if necessary, it will restart three times before failing; its administrative
command is nlsadmin; and the configuration script to be read is in the file script:
# sacadm a p npack t listen c /usr/lib/saf/listen npack v `nlsadmin V` n 3 z script
150. Remove a port monitor: (man pmadm, man sacadm, Ch. 14 BT)
This command reads or modifies /etc/saf/_sactab:
# sacadm r
Example:
Remove a port monitor whose tag is pmtag:
# sacadm r p pmtag
151. Modify(start, stop, enable, disable) a port monitor: (man pmadm, man sacadm, Ch. 14 BT)
These commands read or modify /etc/saf/_sactab:
# sacadm s ,stop
# sacadm k ,start
# sacadm e ,enable
# sacadm d ,disable
Examples:
Start the port monitor whose tag is pmtag:
# sacadm s p pmtag
Stop the port monitor whose tag is pmtag:
# sacadm k p pmtag
Enable the port monitor whose tag is pmtag:
# sacadm e p pmtag
Disable the port monitor whose tag is pmtag:
# sacadm d p pmtag
152. Configure a service: (man pmadm, man sacadm, Ch. 14 BT, Happy's Sysadmin book)
General Service Information. For specifics see the item entries following this one.
sacadm service access controller administration
# sacadm a p pmtag t type c cmd v ver [f dx] [n count] [y comment] [z script]
# sacadm r p pmtag
# sacadm s p pmtag
# sacadm k p pmtag
# sacadm e p pmtag
# sacadm d p pmtag
# sacadm l [p pmtag | t type]
# sacadm L [p pmtag | t type]
# sacadm g p pmtag [z script]
# sacadm G [z script]
# sacadm x [p pmtag]
DESCRIPTION
sacadm is the administrative command for the upper level of the Service Access Facility hierarchy, that is, for port
monitor administration. sacadm performs the following functions:
adds or removes a port monitor
starts or stops a port monitor
enables or disables a port monitor
installs or replaces a persystem configuration
script
installs or replaces a perport monitor configuration
script
prints requested port monitor information
Requests about the status of port monitors (l and L) and requests to print perport monitor and persystem
configuration scripts (g and G without the z option) may be executed by any user on the system. Other sacadm
commands may be executed only by a privileged user.
The options have the following meanings:
a Add a port monitor. When adding a port monitor, sacadm creates the supporting directory structure in /etc/saf and
/var/saf and adds an entry for the new port monitor to /etc/saf/_sactab. The file _sactab already exists on the delivered
system. Initially, it is empty except for a single line, which contains the version number of the Service Access Controller.
Unless the command line that adds the new port monitor includes a f option with the argument x, the new port monitor
will be started. Because of the complexity of the options and arguments that follow the a option, it may be convenient
to use a command script or the menu system to add port monitors. If you use the menu system, enter sysadm ports
and then choose the port_monitors option.
c cmd
Execute the command string cmd to start a port monitor. The c option may be used only with a a. A a option requires
a c.
d Disable the port monitor pmtag.
e Enable the port monitor pmtag.
f dx
The f option specifies one or both of the following two flags which are then included in the flags field of the _sactab
entry for the new port monitor. If the f option is not included on the command line, no flags are set and the default
conditions prevail. By default, a port monitor is started. A f option with no following argument is illegal.
d Do not enable the new port monitor.
x Do not start the new port monitor.
g The g option is used to request output or to install or replace the perport monitor configuration script
/etc/saf/pmtag/_config. g requires a p option. The g option with only a p option prints the perport monitor
configuration script for port monitor pmtag. The g option with a p option and a z option installs the file script as the
perport monitor configuration script for port monitor pmtag. Other combinations of options with g are invalid.
G The G option is used to request output or to install or replace the persystem configuration script
/etc/saf/_sysconfig. The G option by itself prints the persystem configuration script. The G option in combination
with a z option installs the file script as the persystem configuration script. Other combinations of options with a
G option are invalid.
k Stop port monitor pmtag. All services invoked by the port monitor, including ttymon login services, are killed.
l The l option is used to request port monitor information. The l by itself lists all port monitors
on the system. The l option in combination with the p option lists only the port monitor specified by pmtag. A l
in combination with the t option lists all port monitors of type type. Any other combination of options with the l
option is invalid.
L The L option is identical to the l option except that the output appears in a condensed format.
n count
Set the restart count to count. If a restart count is not specified, count is set to 0. A count of 0
indicates that the port monitor is not to be restarted if it fails.
p pmtag
Specifies the tag associated with a port monitor.
r Remove port monitor pmtag. sacadm removes the port monitor entry from /etc/saf/_sactab. If the removed port
monitor is not running, then no further action is taken. If the removed port monitor is running, the Service Access
Controller (SAC) sends it SIGTERM to indicate that it should shut down. This may result in killing all services
invoked by the port monitor. Note that the port monitor's directory structure remains intact.
s Start a port monitor. The SAC starts the port monitor pmtag.
t type
Specifies the port monitor type.
v ver
Specifies the version number of the port monitor. This version number may be given as
v `pmspec V`
where pmspec is the special administrative command for port monitor pmtag. This special command is ttyadm for
ttymon and nlsadmin for listen. The version stamp of the port monitor is known by the command and is returned
when pmspec is invoked with a V option.
x The x option by itself tells the SAC to read its database file (_sactab). The x option with the p
option tells port monitor pmtag to read its administrative file.
y comment
Include comment in the _sactab entry for port monitor pmtag.
z script
Used with the g and G options to specify the name of a file that contains a configuration script. With the g option,
script is a perport monitor configuration script; with G it is a persystem configuration script. Modifying a
configuration script is a three step procedure. First a copy of the existing script is made (g or G). Then the copy is
edited. Finally, the copy is put in place over the existing script (g or G with z).
OUTPUT
If successful, sacadm will exit with a status of 0. If sacadm fails for any reason, it will exit with a nonzero status.
Options that request information will write the information on the standard output. In the condensed format (L), port
monitor information is printed as a sequence of colonseparated fields; empty fields are indicated by two successive
colons. The standard format (l) prints a header
identifying the columns, and port monitor information is aligned under the appropriate headings. In this format, an
empty field is indicated by a hyphen. The comment character is #.
EXAMPLES
The following command line adds a port monitor. The port monitor tag is npack; its type is listen; if necessary, it will
restart three times before failing; its administrative command is nlsadmin; and the configuration script to be read is in
the file script:
sacadm a p npack t listen c /usr/lib/saf/listen npack v `nlsadmin V` n 3 z script
Remove a port monitor whose tag is pmtag:
sacadm r p pmtag
Start the port monitor whose tag is pmtag:
sacadm s p pmtag
Stop the port monitor whose tag is pmtag:
sacadm k p pmtag
Enable the port monitor whose tag is pmtag:
sacadm e p pmtag
Disable the port monitor whose tag is pmtag:
sacadm d p pmtag
List status information for all port monitors:
sacadm l
List status information for the port monitor whose tag is pmtag:
sacadm l p pmtag
List the same information in condensed format:
sacadm L p pmtag
List status information for all port monitors whose type is listen:
sacadm l t listen
Replace the perport monitor configuration script associated with the port monitor whose tag is pmtag with the contents
of the file file.config:
sacadm g p pmtag z file.config
FILES
/etc/saf/_sactab
/etc/saf/_sysconfig
/etc/saf/pmtag/_config
153. Add a service: (man pmadm, man sacadm, Ch. 14 BT)
This command reads or modifies the corresponding /etc/port_monitor/_pmtab:
# pmadm a (add)
Example:
Add a service to a port monitor with tag pmtag. Give the service the tag svctag. Port monitorspecific information is
generated by specpm. The service defined by svctag will be invoked with identity root.
# pmadm a p pmtag s svctag i root m `specpm a arg1 b arg2` v `specpm V`
154. Remove a service: (man pmadm, man sacadm, Ch. 14 BT)
This command reads or modifies the corresponding /etc/port_monitor/_pmtab:
# pmadm r (remove)
Example:
Remove the service svctag from port monitor pmtag:
# pmadm r p pmtag s svctag
155. Modify(enable, disable) a service: (man pmadm, man sacadm, Ch. 14 BT)
These commands read or modify the corresponding /etc/port_monitor/_pmtab:
# pmadm e (enable)
# pmadm d (disable)
Example:
Enable the service svctag available through port monitor pmtag:
# pmadm e p pmtag s svctag
Disable the service svctag available through port monitor pmtag:
# pmadm d p pmtag s svctag
156. Add a service to one or all port monitors: (Ch. 14 BT, man pmadm)
Add a service with service tag svctag, identity guest, and port monitorspecific information generated by specpm to all
port monitors of type type:
# pmadm a s svctag i guest t type m `specpm a arg1 b arg2` v `specpm V`
157. Setup/Add a serial port for a terminal: (Ch. 14 BT, man pmadm, man sacadm, CLI Ch. 9)
TTY ports are managed by a ttymon process, the files /etc/saf/pmtag/_pmtab and /etc/ttydefs, and the sttymon command.
The ttymon process replaces the getty and uugetty processes in older Unix versions. Ttymon initializes and monitors TTY
ports, sets terminal nodes and line speeds, and invokes the service associated with a given port when it receives a
connection request.
The ttydefs file contains speed and terminal settings for the TTY ports.
The Network Port Monitors are in the listen(1M) man page.
Procedure:
1. If a 'sac' process and a 'ttymon' process are not running (else goto 2):
# sacadm a p pm1 t ttymon c /usr/lib/saf/ttymon v 1
2. Start a port service for the terminal connected to your port:
# pmadm a p pm1 s 00 i root f u v 1 m " `ttyadm h d /dev/term/00s \
l 9600 s /usr/bin/login` "
(pmadm modifies the /etc/saf/pmtag/_pmtab file)
3. Using vi, enter a line in the /etc/ttytype file like:
vt100 tty00s
158. Remove a serial port's terminal: (Ch. 14 BT, man pmadm, man sacadm, CLI Ch. 9)
# pmadm r p pmtag s svctag
Examples:
Create an entry:
# pmadm a p pm1 s 00 i root f u v 1 m " `ttyadm h d /dev/term/00s \
l 9600 s /usr/bin/login` "
Remove the entry:
# pmadm r p pm1 s 00
159. How to use stty: (Ch. 10 CLI, man stty)
Stty sets certain terminal I/O options for the device that is the current standard input; without arguments, it reports the
settings of certain options.
Set up the options for a terminal:
# stty erase ^h echoe icrnl iuclc < /dev/term/s00
# /usr/ucb/stty [ a ] [ g ] [ h ] [ options ]
erase ^h = set the erase character to CTRLh.
echoe = Do not destroy characters when backspacing.
icrnl = Make newline work properly (place cursor on the next line)
iuclc = Don't map uppercase characters to lowercase during input.
a = reports all of the option settings;
g = reports current settings in a form that can be used as an argument to another stty command.
h = reports all the option settings with the control characters in an easy to read column format.
Examples:
# stty LCASE (change an uppercase terminal to lowercase)
# stty erase ^h echoe icrnl iuclc < /dev/term/s00
# stty "9600 parodd parenb cstopb cs8 clocal ixon ixany opost onlcr olcuc cr0 nl0 bs0 ff0 vt0 tab3"
# stty columns 80
# stty a
160. Configure a serial port for a modem: (Ch. 9 CLI)
1. If sac and ttymon are not running:
# sacadm a p pm2 t ttymon c /usr/lib/saf/ttymon v 1
2. Use vi and edit the /etc/uucp/Dialers file to include entries for your modem:
Example:
hayes=,,"" \M\dAT\r\c OK\r \EATDT\T\r\c CONNECT \m\c clocal "" ""\M\c
See Chapter 15, Managing BNU Section 'Writing Dialing Information' of the CLI manual, for more information about the
escape sequences.
3. Edit the /etc/uucp/Devices file to place entries for the modem at the end of the file:
Example:
ACU term/00,M 2400 Hayes
Direct term/00,M 2400 clocal
4. Start the port service for the modem:
# pmadm a p pm2 s 00 i root f u v 1 m " `ttyadm bhr1 o6 d \
/dev/term/00 1 2400NP s /usr/bin/login` "
161. Start and stop the lp print service: (Ch. 10 CLI, man lpsched, man lpshut)
# /usr/lib/lp/lpsched
# lpsched
# lpshut
162. Move print requests to a different printer: (man lpmove, Ch. 13 BT)
# lpmove requests dest
# lpmove dest1 dest2
Example:
# lpmove ptr1 ptr2
163. Cancel a print job without disabling the printer: (TEC book, man lp, man cancel)
# cancel ptr1 ,ptr1 is a printer.
# cancel ptr18 ,ptr18 is its requests ID.
164. Send a print request: (TEC book, man lp, man cancel)
# lp [options] file1 [file2...]
Examples:
# lp n2 /etc/inittab (print 2 copies)
# lp d ptr1 t "equipment request" letter3 (print the file letter3 and title it)
165. Display status of the lp print service: (TEC book, man lpstat)
# lpstat [options]
# lpstat t (print all information)
166. Add a new printer destination: (BT Ch. 13, TEC book, Ch. 10 AT, man lpadmin)
# lpadmin p printer v device m interface T type [c class]
printer = arbitrary printer name.
device = printers special file name.
interface = interface script.
type = from the terminfo database in /usr/share/lib/terminfo.
class = assigns the printer to a class queue. Creates one if it does not exist.
Example:
# chown lp /dev/term/s00 (make sure nonlp processes can not write to this special file)
# chmod 600 /dev/term/s00
# lpadmin p ptr1 v /dev/term/s00 T citoh m standard
Now make it available to print requests:
# accept ptr1
# enable ptr1
167. Modify a printer/printer destinations: (BT Ch. 13, TEC book, Ch. 10 AT, man lpadmin)
# lpadmin d ptr1 (make the printer the default destination)
# lpadmin p ptr1 v /dev/term/s06 (change it's device)
# lpadmin p ptr1 m custom (change the interface program)
# lpadmin p ptr1 h [l] (specify printer as hardwired or login terminal.)
# lpadmin p ptr1 c accounting (add ptr1 to the accounting class)
# lpadmin p ptr1 r accounting (remove it from the accounting class)
168. Remove a printer: (BT Ch. 13, TEC book, Ch. 10 AT, man lpadmin)
# lpadmin x ptr1
169. Accept a printer: (Ch. 11 BT, man accept)
# accept ptr1 (accept a printer for service)
170. Reject requests to a printer: (Ch. 11 BT, man reject)
# reject r "comment" ptr1
r = the reason you are rejecting the printer.
Note: To display the reason a printer is rejected use:
# lpstat p (display the status of all printers)
171. Enable a printer: (Ch. 11 BT, man enable)
# enable ptr1 (get the printer online)
172. Disable a printer: (Ch. 11 BT, man disable)
# disable [c | w ] [r "command"] [W] printername
Examples:
# disable c r "comment" ptr1
# disable ptr1
w = wait for the current job to finish.
c = cancel the current job/print request.
173. Specify printer port characteristics: (Ch. 10 CLI)
# lpadmin p printername o options
Example:
# pladmin p lp1 v /dev/term/13 T 455 o "width=90 length=71 stty=onclr"
This adds a printer called 'lp1' of the type 455 on printer port /dev/term/13. It should use the standard interface program,
with the default page size of 90 columns by 71 lines, and linefeeds should not be mapped into carriage return/linefeed
pairs.
174. How to setup and use UUCP: (AT Ch. 15, man uucp)
uucp, uulog, uuname UNIXtoUNIX system copy
# uucp [ options ] sourcefiles destinationfile
# uulog [ options ] system
# uuname [ options ]
uucp copies files named by the sourcefile arguments to the destinationfile argument. A source file name may be a
patname on your machine, or, may have the form:
systemname!pathname where systemname is taken from a list of system names that uucp knows about. The
destination systemname may also include a list of system names such as
systemname!systemname!...!systemname!pathname
In this case, an attempt is made to send the file, via the specified route, to the destination. Care should be taken to
ensure that intermediate nodes in the route are willing to forward information (see NOTES below for restrictions).
The shell metacharacters ?, * and [...] appearing in pathname will be expanded on the appropriate system.
Path names may be one of:
(1) a full pathname;
(2) a pathname preceded by ~user where user is a login name on the specified system and is replaced by that user's
login directory;
(3) a pathname preceded by ~/destination where destination is appended to /var/spool/uucppublic;
(NOTE: This destination will be treated as a file name unless more than one file is being
transferred by this request or the destination is already a directory. To ensure that it is a directory, follow the
destination with a '/'. For example ~/dan/ as the destination will make the directory /var/spool/uucppublic/dan if it does
not exist and put the requested file(s) in that directory).
(4) anything else is prefixed by the current directory. If the result is an erroneous pathname for the remote
system, the copy will fail. If the destinationfile is a directory, the last part of the sourcefile name is used.
uucp removes execute permissions across the transmission and gives 0666 read and write permissions (see chmod(2)).
The following options are interpreted by uucp:
c Do not copy local file to the spool directory for transfer to the remote machine (default).
C Force the copy of local files to the spool directory for transfer.
d Make all necessary directories for the file copy (default).
f Do not make intermediate directories for the file copy.
ggrade grade can be either a single letter/number or a string of alphanumeric characters defining a
service grade. The uuglist command can determine whether it is appropriate to use the single
letter/number or a string of alphanumeric characters as a service grade. The output from
the uuglist command will be a list of service grades that are available or a message that says
to use a single letter/number as a grade of service.
j Output the uucp job identification string on the standard output. This job identification can be
used by uustat to obtain the status of a uucp job or to terminate a uucp job. It is valid as long
as the job remains queued on the local system.
m Send mail to the requester when the copy is completed.
nuser Notify user on the remote system that a file was sent.
r Do not start the file transfer, just queue the job.
sfile Report status of the transfer to file. This option overrides the m option.
xdebug_level Produce debugging output on standard output. debug_level is a number between 0 and 9; as it
increases to 9, more detailed debugging information is given. This option may not be available on all systems.
uulog
uulog queries a log file of uucp or uuxqt transactions in file /var/uucp/.Log/uucico/system or
/var/uucp/.Log/uuxqt/system.
These options cause uulog to print logging information:
ssys Print information about file transfer work involving system sys.
fsystem Does a "tail f" of the file transfer log for system. (You must hit BREAK to exit this
function.)
Other options used in conjunction with the above options
are:
x Look in the uuxqt log file for the given system.
number Indicates that a "tail" command of number lines should be executed.
uname
uuname lists the names of systems known to uucp. uuname recognizes the following options:
c Returns the names of systems known to cu. (The two lists are the same, unless your machine is
using different Systems files for cu and uucp. See the Sysfiles file.)
l Return the local system name.
FILES
/var/spool/uucpspool directories
/var/spool/uucppublic/*public directory for receiving and sending
/usr/lib/uucp/*other program files
/etc/uucp/* other data files
Setting up UUCP example:
This is an example that will install UUCP over the WINTCP network. With UUCP running you can send files to an
account on a remote machine without entering the account password. There is a shell script at the bottom of this example.
This procedure provides a means of executing batch file transfers:
Preparing the system:
1. WINTCP should be installed.
2. An entry for the system you are using for installation, and an entry for each host to be reached via UUCP, must be
available either in the /etc/hosts file or through Domain Name Service. Host entries must include both the host's name and
it's internet address. If the name or internet address of a host has changed, you need to repeat portions of this procedure to
adjust for the change.
3. You must be logged in as 'root'.
4. You should be familiar with the nlsadmin(1M) manual page.
Setting up the network:
1. Copy the following shell script and add entries for all the remote hosts you want to communicate with. The information
you need to change for your particular network is in the '#Add an entry' area of the script where you define host1, etc.
2. Perform the script on both machines.
[begin script]
# uucp setup for WINTCP
# Create and initialize files needed by the network listener process
/usr/sbin/nlsadmin l tcp
# Add the uucp (uucico) service to the listener's database file
# for the network
/usr/sbin/nlsadmin a 101 c "usr/lib/uucp/uucico r 0 i TLI u nuucp" y "uucp listener" tcp
# Create the TCP/IP listener address for the local machine
localname='uname'
localaddr='/usr/etc/rfsaddr h $localname'
/usr/sbin/nlsadmin l $localaddr tcp
# Append the /etc/uucp/Dialers entry
grep "^TCP\,eg" /etc/uucp/Dialers
if [ $? != 0 ]
then
echo 'tcp "" "" NLPS:000:001:101\N\C ' >> /etc/uucp/Dialers
fi
# Append the /etc/uucp/Devices entry
grep "^TCP\,eg" /etc/uucp/Devices
if [ $? != 0 ]
then
echo 'TCP,eg tcp TLI D tcp' >> /etc/uucp/Devices
fi
# Add an entry for each host you want to communicate with
host1=res1
host2=primary
addr='/usr/etc/rfsaddr h $host1'
grep "$addr" /etc/uucp/Systems
if [ $? != 0 ]
then
echo "$host1 Any TCP $addr" >> /etc/uucp/Systems
fi
addr='/usr/etc/rfsaddr h $host2'
grep "$addr" /etc/uucp/Systems
if [ $? != 0 ]
then
echo "$host2 Any TCP $addr" >> /etc/uucp/Systems
fi
# Start the listener
nlsadmin s tcp
[end script]
Another Example script:
(UUCP / Remote Printing over TCP/IP)
#!/bin/ksh
[begin]
ENDPOINTS=/tmp/endpoints.$$
echo "Creating S76uucpsetup rc2.d script"
##################################################
# Start building rc script S76uucpsetup) to assure nodes
# are setup in /dev (could have been deleted
# after kernel relink). Also S76uucpsetup assures that
# /etc/netconfig has the required entries.
#
SETUPRC=/etc/init.d/uucpsetup
echo "#!/bin/ksh" > $SETUPRC
echo "# This script (S76uucpsetup) will " >> $SETUPRC
echo "# assure nodes for UUCP are setup after reboot " >> $SETUPRC
echo "# in case kernel has been rebuilt (could have " >> $SETUPRC
echo "# removed /dev when major/minor #s change on " >> $SETUPRC
echo "# pkgadd. Also assures proper entries are in " >> $SETUPRC
echo "# /etc/netconfig for uucp. " >> $SETUPRC
echo "echo \"Checking UUCP setup...\"" >> $SETUPRC
echo "ENDPOINTS=/tmp/endpoints.\$\$" >> $SETUPRC
echo "netstat i | egrep v \"^Name.*Address|Loopback\" | \\" >> $SETUPRC
echo " nawk '{ print \$3 }' > \$ENDPOINTS" >> $SETUPRC
echo "NETCONFIG=\`egrep \"^tcp\" /etc/netconfig\`" >> $SETUPRC
echo "while read NETWORK" >> $SETUPRC
echo "do" >> $SETUPRC
echo " #" >> $SETUPRC
echo " # port monitor tags must be alphanumeric, but stuff in /etc/networks" \
>> $SETUPRC
echo " # can be anything. This tries to weed out the nonalphanum stuff" \
>> $SETUPRC
echo " #" >> $SETUPRC
echo " ALPHA_NETWORK=\`echo \$NETWORK | sed 's/[^AZaz09]//g'\`" \
>> $SETUPRC
echo " NETWORK=\$ALPHA_NETWORK" >> $SETUPRC
echo " #" >> $SETUPRC
echo " # This sets up the network definitions in the /etc/netconfig" \
>> $SETUPRC
echo " # Database. " >> $SETUPRC
echo " #" >> $SETUPRC
echo " MY_NETCONFIG=\`echo \$NETCONFIG | sed \"s/^tcp/\$NETWORK/\"\`" \
>> $SETUPRC
echo " grep \"^\$MY_NETCONFIG\" /etc/netconfig >/dev/null 2>&1" >> $SETUPRC
echo " if [ \$? eq 1 ]" >> $SETUPRC
echo " then" >> $SETUPRC
echo " echo \$MY_NETCONFIG >> /etc/netconfig" >> $SETUPRC
echo " fi" >> $SETUPRC
echo " #" >> $SETUPRC
echo " # This checks for nodes in /dev for each network listener" \
>> $SETUPRC
echo " # (workaround for current prob w/ listener) " >> $SETUPRC
echo " #" >> $SETUPRC
echo " if [ ! c /dev/\$NETWORK ]" >> $SETUPRC
echo " then" >> $SETUPRC
echo " if [ c /dev/tcp ]" >> $SETUPRC
echo " then" >> $SETUPRC
echo " MAJMIN=/tmp/majmin" >> $SETUPRC
echo " ls la /dev/tcp | nawk '{print \$5 \" \" \$6}' \\" >> $SETUPRC
echo " | sed \"s/,//\" >\$MAJMIN" >> $SETUPRC
echo " while read MAJ MIN" >> $SETUPRC
echo " do" >> $SETUPRC
echo " #" >> $SETUPRC
echo " # Create node for listener device" >> $SETUPRC
echo " #" >> $SETUPRC
echo " /sbin/mknod /dev/\$NETWORK c \$MAJ \$MIN" >> $SETUPRC
echo " /usr/bin/chmod 666 /dev/\$NETWORK" >> $SETUPRC
echo " done < \$MAJMIN" >> $SETUPRC
echo " rm f \$MAJMIN" >> $SETUPRC
echo " fi" >> $SETUPRC
echo " fi" >> $SETUPRC
echo "done < \$ENDPOINTS" >> $SETUPRC
echo "rm f \$ENDPOINTS" >> $SETUPRC
echo "echo \"Finished UUCP check\"" >> $SETUPRC
#
# Make link in /etc/rc2.d directory
#
chmod 766 /etc/init.d/uucpsetup
ln /etc/init.d/uucpsetup /etc/rc2.d/S76uucpsetup > /dev/null 2>&1
######################################
# Done Building RC Script
#############################
# Start creating UUCP setup
######################################
echo "Starting UUCP setup..."
#
# Create file containing "Network" & "Address" of each network
# interface. Will be used to setup port monitors
#
netstat i | egrep v "^Name.*Address|Loopback" | \
nawk '{ print $3 " " $4 }' > $ENDPOINTS
#
#check to see if listen is defined in /etc/services. If not, add.
#
echo "\tChecking/Adding \"listen\" to /etc/services"
grep "listen" /etc/services > /dev/null 2>&1
if [ $? != 0 ]
then
echo 'listen 2766/tcpattlisten saflisten listener # listener' \
>> /etc/services
fi
#
# get listen port number
#
LISTEN_PORT=`egrep "^listen" /etc/services | awk '{ print $2; exit }' | sed 's,\
/.*,,g' `
LISTEN_PORT=${LISTEN_PORT:"2766"}
#
# Get "tcp" definition from /etc/netconfig Database
#
NETCONFIG=`egrep "^tcp" /etc/netconfig`
#
# Define the tcp entry in the /etc/uucp/Dialers file if required.
#
echo "\tChecking/Adding tcp entry in /etc/uucp/Dialers file."
grep "^tcp" /etc/uucp/Dialers > /dev/null 2>&1
if [ $? eq 1 ]
then
echo 'tcp "" "" NLPS:000:001:101\\N\\c' >>/etc/uucp/Dialers
fi
#
# NETWORK will be the name of the transport interface listener,
# and NAME is the entry in the host file for that interface for
# this machine.
#
while read NETWORK NAME
do
#
# port monitor tags must be alphanumeric, but stuff in /etc/networks
# can be anything. This tries to weed out the nonalphanum stuff
#
ALPHA_NETWORK=`echo $NETWORK | sed 's/[^AZaz09]//g'`
NETWORK=$ALPHA_NETWORK
#
# build listen address
#
LISTEN_ADDRESS=`/usr/etc/rfsaddr h $NAME p $LISTEN_PORT`
#
# check to see if the port monitor is listening on a previous address
#
if [ "$LISTEN_ADDRESS" != "`nlsadmin l $NETWORK`" ]
then
#
# remove all knowledge of the port monitor
#
echo "\tCreating $NETWORK listen address."
/usr/sbin/sacadm r p $NETWORK
rm rf /etc/saf/$NETWORK
fi
#
# start listen monitor and initialize if needed
#
sacadm l p $NETWORK > /dev/null 2>&1
if [ $? ne 0 ]
then
echo "\tAdding $NETWORK listen service... "
nlsadmin i $NETWORK
if [ $? eq 0 ]
then
/usr/bin/nlsadmin l $LISTEN_ADDRESS $NETWORK
if [ $? ne 0 ]
then
echo "Error: adding listen service and address"
fi
fi
fi
#
# start lp service This will setup lp service on listen port
#
pmadm l p $NETWORK s lp > /dev/null 2>&1
if [ $? ne 0 ]
then
echo "\tAdding lp service... "
pmadm a p $NETWORK s lp i root v `nlsadmin V` \
m `nlsadmin o /var/spool/lp/fifos/listenS5`
if [ $? ne 0 ]
then
echo "Error: adding lp service to port monitor"
fi
fi
#
# start uucico service
#
pmadm l p $NETWORK s 101 > /dev/null 2>&1
if [ $? ne 0 ]
then
echo "\tAdding uucico service... "
nlsadmin a 101 c "/usr/lib/uucp/uucico r 0 i TLI u uucp" \
y "uucp listener for net $NETWORK" $NETWORK
if [ $? ne 0 ]
then
echo "Error: adding uucicio service to port monitor"
fi
fi
#
# This sets up the network definitions in the /etc/netconfig
# Database.
#
echo "\tChecking/Adding $NETWORK to /etc/netconfig..."
MY_NETCONFIG=`echo $NETCONFIG | sed "s/^tcp/$NETWORK/"`
grep "^$MY_NETCONFIG" /etc/netconfig >/dev/null 2>&1
if [ $? eq 1 ]
then
echo $MY_NETCONFIG >> /etc/netconfig
fi
#
# This checks for nodes in /dev for each network listener
# and adds if required
#
echo "\tChecking/Adding /dev/$NETWORK..."
if [ ! c /dev/$NETWORK ]
then
if [ c /dev/tcp ]
then
MAJMIN=/tmp/majmin
ls la /dev/tcp | nawk '{print $5 " " $6}' | sed "s/,//">$MAJMIN
while read MAJ MIN
do
#
# Create node for listener device
#
/sbin/mknod /dev/$NETWORK c $MAJ $MIN
/usr/bin/chmod 666 /dev/$NETWORK
done < $MAJMIN
rm f $MAJMIN
fi
fi
# Check to see if listen port is running. If not, start
#
nlsadmin q $NETWORK
if [ $? eq 1 ]
then
echo "\tStarting $NETWORK listen deamon."
nlsadmin s $NETWORK > /dev/null 2>&1
if [ $? ne 0 ]
then
echo "Error: starting $NETWORK port monitor"
fi
fi
#
# Add the net_spec to the /etc/uucp/Devices file
#
echo "\tChecking/Adding Device file for $NETWORK entry."
grep "^$NETWORK" /etc/uucp/Devices >/dev/null 2>&1
if [ $? eq 1 ]
then
echo "Adding $NETWORK to Devices file."
echo $NETWORK"Device,eg "$NETWORK" TLI \D tcp" \
>>/etc/uucp/Devices
fi
done < $ENDPOINTS
rm f $ENDPOINTS
echo "UUCP setup completed..."
echo " "
echo "REMEMBER This script did not setup the /etc/uucp/Systems"
echo " nor /etc/uucp/Permissions files. You must set"
echo " these up by hand."
[end]
Example of setting up UUCP over multiple TCP/IP Interfaces:
Introduction: This document is in response to a multitude of problems that we have recently encountered with setting up
UUCP over TCP/IP on the NCR 3600. The intent of this paper is not to make you a UUCP guru, rather it is intended as a
condensed explanation and procedure for installing UUCP over TCP/IP.
Section 1: Detailed Explanation Of Basic UUCP Setup Over TCP/IP
Section 2: Testing The UUCP Set Up
Section 3: A Simple Shell For Automating UUCP Setup Over TCP/IP
Section 4: Reference Material
Section 1: Detailed Explanation Of Basic UUCP Setup Over TCP/IP
This section documents the steps taken to get UUCP working on the 3600 over multiple network interfaces. In this
example, two network interfaces were used, the YNET, and an Ethernet interface. A two AP system was used withthe APs
being named app0020 and app0021. There are three general steps
in setting up UUCP over TCP/IP:
Section 1.1: Define The Network Listen Process For Each Network Interface
Section 1.2: Define The Services For Each Network Listen Process
Section 1.3: Configure The UUCP Files To Use The Network Interfaces
Section 1.1: Define Network Listen Process For Each Network Interface
This section discusses the steps necessary to set up a listen process on each of the network interfaces. It then describes
how to assign a RFS address to each of the listener processes.
1) Find out what network interfaces are available:
Command Syntax: # netstat i
Description: The interface display (i) shows the status of the configured network interfaces. This display includes: the
interface name; the maximum transmission unit (Mtu) in bytes; the network and interface addresses; the number of
packets received and sent; and, the number of send and receive errors.
For app0020 the output was:
# netstat i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
en0 1500 enet app0020_e 2664595 0 610381 0
en1 1500 p_net app0020_p 63449 0 6261 0
lo0 4096 Loopback me 4260 0 4258 0
dlyn 32708 ynet app0020 928980 0 948860 0
For app0021 the output was:
# netstat i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
en0 1500 enet app0021_e 2190566 0 68618 0
en1 1500 p_net app0021_p 63472 0 6258 0
lo0 4096 Loopback me 4260 0 4258 0
dlyn 32708 ynet app0021 108723 0 88814 0
This shows the network address ("Network") and the interface addresses ("Address") available for each of the APs. In this
example, both Aps have the same network address, however there is no need for both sides
to have matching addresses. We will use the "enet" and "ynet" network addresses for this example.
NOTE: Because port monitor services require alphanumeric port monitor tags, you may need to modify the information
given by the netstat i command. You do not need to change the interface, simply take the
information and eliminate any nonalphanumeric characters for use in this procedure. For example, the network address
p_net is shown in our example. We would have used pnet if we were going to set up UUCP over this network interface.
2) Verify what port the listen process uses and add to the /etc/services
file if necessary:
Description: The Services file contains information regarding the known services available in the DARPA Internet. For
each service, a single line should be present with the following information:
officialservicename portnumber/protocolname aliases
Fields are separated by any number of blanks and/or tab characters. The port number and protocol name are
considered a single field; the slash separates the port and protocol (e.g. ``512/tcp''). A pound
sign (#) indicates the beginning of a comment; characters up to the end of the line are not interpreted by routines that
search the file.
Service names may contain any printable character other than a space, tab, newline, or comment character.
Historically, there have been two "well known" port numbers used for the listen process in the NCR 3000 (SVR4) systems.
They are 1025/tcp and 2766/tcp. It does not matter which is used, you just need to be
consistent. This port number will be used in setting up the address of the listen process as well as in the UUCP Systems
file. In the current SVR4 release, the default port number is 2766/tcp thus we used it in our
example.
On app0020 and app0021, we found that the listen port was not defined in the /etc/services file by doing the following:
# grep "listen" /etc/services
#
Since there was no definition for the listen process, we added the following line (using vi) to the /etc/services file:
listen 2766/tcp attlisten saflisten listener # listener
3) Find out if there are any network listener processes already defined on the APs:
Command Syntax: # nlsadmin x
Description: Reports the status of all of the listener processes installed on this machine.
If there are any network listener processes running, they will be shown. For our example, the AP systems that we were
using had a network listener process running from a previous attempt at getting UUCP over
TCP/IP working. The output on both app0020 and app0021 looked as follows:
# nlsadmin x
tcp ACTIVE
4) Determine if the currently defined network listener processes are needed or will conflict with the listener processes
you are going to setup. Delete them if necessary:
In the example, we knew that the currently defined listener process was not needed since it was from a previous attempt at
setting up UUCP over TCP/IP that we had done ourselves. We also knew that it would conflict with our new setup so we
decided to delete the currently defined listener process. You can delete the listener process through the sysadm menu items
(choose ports, port monitors, remove and mark (F2) )
however this will not remove all the files. As an alternative do the following:
Command Syntax: # /usr/sbin/sacadm r p <net_spec>
Command Syntax: # rm rf /etc/saf/<net_spec>
Since both app0020 and app0021 had the tcp network listener process defined, the following commands were entered on
both APs to remove it:
# /usr/sbin/sacadm r p tcp
# rm rf /etc/saf/tcp
Caution: You should not remove listen processes unless you are sure of what you are doing. There are many networking
products that may setup these listen processes and services. If you are unsure, you should consult with the systems
administrator. Also use the nlsadmin v <net_spec> command to show all the services defined on the network listen
process. This may help determine the origin.
5) Create and initialize the files needed by the network listener process for each network interface:
Command Syntax: # nlsadmin i <net_spec>
Description: Initializes an instance of the listener for the network specified by net_spec; that is, creates and initializes the
files required by the listener as well as starting that instance of the listener. Note that a particular instance of the
listener should be initialized only once. The listener must be initialized
before assigning addresses or services.
On both app0020 and app0021 the network interface names were the same so the following commands were done on
both APs:
# nlsadmin i enet
# nlsadmin i ynet
6) Verify that the listener processes were setup:
Command Syntax: # nlsadmin v <net_spec>
The output on both app0020 and app0021 are the same at this point:
# nlsadmin v enet
0 NOADDR ENABLED NORPC root NOMODULES
/usr/lib/saf/nlp s_server # NLPS server
# nlsadmin v ynet
0 NOADDR ENABLED NORPC root NOMODULES
/usr/lib/saf/nlps_server # NLPS server
7) Find the RFS address for each of the network listener processes:
Command Syntax: /usr/etc/rfsaddr h <host name> p <port>
Description: The rfsaddr command converts an Internet address and port number to an address recognized by the
Network Listener and Remote File Services. If no arguments are given to the rfsaddr command, it will read a host name
from the standard input and use the port number 2766.
The h option can be used to specify a host name on the command line. Host can be either the official host name or a valid
alias.
The p option can be used to specify a port number on the command line. Port must be a greater than 1024. The
specified port will be used by the Network Listener Service to handle RFS traffic and
should therefore be a valid TCP port not otherwise in use on the local host.
The format of the address constructed by rfsaddr is:
\xfamilyportinaddr
where \x indicates the address is in hexadecimal, family is a four digit hex encoding of the address family, port is a four
digit hex encoding of the port number, and inaddr is an eight digit hex encoding of the Internet address.
To find out the address (corresponds to a /etc/hosts entry) of each interface, use the netstat i command.
For app0020 the output was:
# netstat i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
en0 1500 enet app0020_e 2664595 0 610381 0
en1 1500 p_net app0020_p 63449 0 6261 0
lo0 4096 Loopback me 4260 0 4258 0
dlyn 32708 ynet app0020 928980 0 948860 0
For app0021 the output was:
# netstat i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
en0 1500 enet app0021_e 2190566 0 68618 0
en1 1500 p_net app0021_p 63472 0 6258 0
lo0 4096 Loopback me 4260 0 4258 0
dlyn 32708 ynet app0021 108723 0 88814 0
We then used the rfsaddr command to get the RFS address format for each of the network interfaces that we had setup
listen processes on (enet & ynet):
For app0020 the output was:
# /usr/etc/rfsaddr h app0020 p 2766
\x00020ace8001c010
# /usr/etc/rfsaddr h app0020_e p 2766
\x00020ace84f26fab
For app0021, the output was:
# /usr/etc/rfsaddr h app0021 p 2766
\x00020ace8001c011
# /usr/etc/rfsaddr h app0021_e p 2766
\x00020ace84f26fac
8) Define the RFS address for each of the network listener processes:
Command Syntax: # /usr/bin/nlsadmin l <RFS address> <net_spec>
Description: nlsadmin l address net_spec changes or set the transport address on which the listener listens (the general
listener service). This address can be used by remote processes to access
the servers available through this listener (see the a option).
If address is just a dash (""), nlsadmin will report the address currently configured, instead of changing it.
A change of address takes effect immediately.
Using the addresses obtained in Step 8, we defined the RFS address on each of the listen processes for our example:
For app0020, we entered the following:
# /usr/bin/nlsadmin l "\x00020ace8001c010" ynet
# /usr/bin/nlsadmin l "\x00020ace84f26fab" enet
For app0021, we entered the following:
# /usr/bin/nlsadmin l "\x00020ace8001c011" ynet
# /usr/bin/nlsadmin l "\x00020ace84f26fac" enet
9) Add the definition for each network to the network configuration database (/etc/netconfig)
Because we have defined new listener processes on our network interfaces, we need to define the networks to the system in
the network configuration database.
Definition: The network configuration database, /etc/netconfig, is a system file used to store information about
networks connected to the system and available for use. The netconfig database and the routines that access it
[see getnetconfig(3N)] are part of the UNIX System V Network Selection component. For a detailed description of
the fields, reference the man page for netconfig.
In our example, we have defined two network interfaces, ynet and enet. For app0020 and app0021, the entries are the
same. The following lines were added to the /etc/netconfig file to define these networks:
ynet tpi_cots v inet tcp /dev/tcp /usr/lib/tcpip.so
enet tpi_cots v inet tcp /dev/tcp /usr/lib/tcpip.so
10) Define device nodes for each network interface
In the current release of SVR4 Release 2.0 (2.00.01), the listener code has a bug in it which will be reported. The listen
process tries to access a device based on the name in the /etc/netconfig file rather than
the listed device (/dev/tcp). As a work around, we created device nodes for each interface with the same major and minor
numbers as /dev/tcp.
In our example, on each of the APs we entered the following commands:
# ls la /dev/tcp
crwrwrw 1 root root 0, 41 May 3 15:49 /dev/tcp
This shows the major and minor numbers for /dev/tcp to be 0 and 41 respectively. We then made character special devices
for each of the listener process and set the proper file permissions as follows:
# mknod /dev/ynet c 0 41
# chmod 666 /dev/ynet
# mknod /dev/ynet c 0 41
# chmod 666 /dev/ynet
11) Create the rc script S76uucpsetup to assure UUCP setup at boot
There are several steps in this procedure that require checking at system boot time. The checks are required for several
reasons. In STEP 9 we updated the file /etc/netconfig (network configuration database). This file may be reinitialized
during an update of the WINTCP software. Because of this, it is a good idea to check at boot time that the changes for
UUCP are still in the file and add them if needed.
The second area that we found to check at boot time was the device nodes that we created for each listener process. The
/dev directory may be rebuilt at boot time (idmknod) due to a new kernel being installed.
When this happens, the device nodes that we placed in the /dev directory will disappear. To compensate for this, we
checked at boot time that the device nodes were still in place and added them needed.
We created the following shell script to take care of the boot time requirements for this procedure:
#!/bin/ksh
# This script (S76uucpsetup) will
# assure nodes for UUCP are setup after reboot
# in case kernel has been rebuilt (could have
# removed /dev when major/minor #s change on
# pkgadd. Also assures proper entries are in
# /etc/netconfig for uucp & listen daemons.
echo "Checking UUCP setup..."
ENDPOINTS=/tmp/endpoints.$$
netstat i | egrep v "^Name.*Address|Loopback" | \
nawk '{ print $3 }' > $ENDPOINTS
NETCONFIG=`egrep "^tcp" /etc/netconfig`
while read NETWORK
do
#
# port monitor tags must be alphanumeric, but stuff in /etc/networks
# can be anything. This tries to weed out the nonalphanum stuff
#
ALPHA_NETWORK=`echo $NETWORK | sed 's/[^AZaz09]//g'`
NETWORK=$ALPHA_NETWORK
#
# This sets up the network definitions in the /etc/netconfig
# Database.
#
MY_NETCONFIG=`echo $NETCONFIG | sed "s/^tcp/$NETWORK/"`
grep "^$MY_NETCONFIG" /etc/netconfig >/dev/null 2>&1
if [ $? eq 1 ]
then
echo $MY_NETCONFIG >> /etc/netconfig
fi
#
# This checks for nodes in /dev for each network listener
# (work around for current prob w/ listener)
#
if [ ! c /dev/$NETWORK ]
then
if [ c /dev/tcp ]
then
MAJMIN=/tmp/majmin
ls la /dev/tcp | nawk '{print $5 " " $6}' \
| sed "s/,//" >$MAJMIN
while read MAJ MIN
do
# Create node for listener device
#
/sbin/mknod /dev/$NETWORK c $MAJ $MIN
/usr/bin/chmod 666 /dev/$NETWORK
done < $MAJMIN
rm f $MAJMIN
fi
fi
done < $ENDPOINTS
rm f $ENDPOINTS
echo "Finished UUCP check"
We created the script in the /tmp directory and named the file uucpsetup. After we created the script, we moved it to the
/etc/init.d directory and called it uucpsetup. We then changed the file permissions
and made a hard link to the file in the /etc/rc2.d directory. We did this using the following commands:
# mv /tmp/uucpsetup /etc/init.d/uucpsetup
# chmod 766 /etc/init.d/uucpsetup
# ln /etc/init.d/uucpsetup /etc/rc2.d/S76uucpsetup
Summary of Section 1.1: At this point, a listener process has been setup on each of the network interfaces and an RFS
address defined for each. The networks were defined in the /etc/netconfig database and device nodes were defined in the
/dev directory. The next section discusses setting up the UUCP service for the listener processes.
Section 1.2: Define The Services For Each Network Listen Process
This section discuss the steps necessary to add the UUCP (uucico) service on the network listener processes set up in the
previous section.
1) Add the uucp (uucico) service to each of the network interface listener's data base file:
Command Syntax:
nlsadmin a <service code> c <command> y <comment> <net_spec>
Description: nlsadmin a service_code [p modules] [w name] c cmd y comment : cmd must appear as a single
word to the shell; if arguments are required, the cmd and its arguments must be enclosed in quotation marks. The
comment must also appear as a single word to the shell.
For UUCP, we used the following values for the variable fields of this command:
<service code> = 101
<command> = "/usr/lib/uucp/uucico r 0 i TLI u nuucp"
<comment> = Any description for the service
<net_spec> = [enet / ynet]
The commands for doing this on both app0020 and app0021 was the same and is shown below:
# nlsadmin a 101 c "/usr/lib/uucp/uucico r 0 i TLI u nuucp" \
y "uucp over enet" enet
# nlsadmin a 101 c "/usr/lib/uucp/uucico r 0 i TLI u nuucp" \
y "uucp over ynet" ynet
2) Verify that the services were added properly for the network interfaces:
Command Syntax: # nlsadmin v <net_spec>
Description: nlsadmin v net_spec prints a verbose report on the servers associated with net_spec, giving the service
code, status, command, and comment for each. It also specifies the uid the server
will run as and the list of modules to be pushed, if any, before the server is started.
For app0020, the output was:
# nlsadmin v enet
0 \x00020ace84f26fab ENABLED NORPC root NOMODULES
/usr/lib/saf/nlps_server # NLPS server
101 NOADDR ENABLED NORPC listen NOMODULES
/usr/lib/uucp/uucico r 0 i TLI u nuucp # uucp over enet
# nlsadmin v ynet
0 x00020ace8001c010 ENABLED NORPC root NOMODULES
/usr/lib/saf/nlps_server # NLPS server
101 NOADDR ENABLED NORPC listen NOMODULES
/usr/lib/uucp/uucico r 0 i TLI u nuucp # uucp over ynet
For app0021, the output was:
# nlsadmin v enet
0 \x00020ace84f26fac ENABLED NORPC root NOMODULES
/usr/lib/saf/nlps_server # NLPS server
101 NOADDR ENABLED NORPC listen NOMODULES
/usr/lib/uucp/uucico r 0 i TLI u nuucp # uucp over enet
# nlsadmin v ynet
0 x00020ace8001c011 ENABLED NORPC root NOMODULES
/usr/lib/saf/nlps_server # NLPS server
101 NOADDR ENABLED NORPC listen NOMODULES
/usr/lib/uucp/uucico r 0 i TLI u nuucp # uucp over ynet
3) Enable the listener process on each of the network interfaces
Now that the services have been defined for the listener processes, the listener processes can be enabled for use.
Command Syntax: # nlsadmin s <net_spec>
Description: nlsadmin s net_spec / nlsadmin k net_spec starts / stops the listener process for the indicated network.
These operations will normally be performed as part of the system startup and shutdown procedures. Before a listener
can be started for a particular network, it must first have been initialized (see the i option). When a listener is killed,
processes that are still running as a result of
prior service requests will continue unaffected.
For our example, the following commands were entered on both app0020 and app0021:
# nlsadmin s ynet
# nlsadmin s enet
NOTE: You can check to see if the listeners are started using the nlsadmin x command. It will show you if the listeners
are active or inactive.
Summary of Section 1.2: The UUCP service (server) has now been defined for each of the network listeners and the
listeners enabled. The next section discusses setting up the UUCP files to use the UUCP services.
Section 1.3: Configure The UUCP Files To Use The Network Interfaces
This section discusses setting up the UUCP files to use the UUCP services defined on the network interfaces. Note that
this is not a complete discussion of setting up UUCP. Only the files required to change to use the network interfaces are
discussed. For a more complete discussion of setting up UUCP, see the NCR UNIX SVR4 Administrator Guide:
Advanced Tasks manual (Sections 14 and 15).
1) Set up a tcp entry in the /etc/uucp/Dialers file
The Dialers file specifies the initial conversation (handshaking) that must take place on a "line" before it can be made
available for transferring data. This conversation is usually a sequence of transmitted/expected ASCII strings. For UUCP
over TCP/IP, the following Dialers information should be defined:
tcp "" "" NLPS:000:001:101\N\c
NOTE: Verify that the information is not already in the /etc/uucp/Dialers directory first. If it is not, add the line to the end
of the file.
2) Add a device definition to the /etc/uucp/Devices file for each of the network interface devices
The Devices file contains information for all the devices that may be used to establish a link to a remote system. It
contains information for modems with autodialing capabilities, direct links, and network
connections. The Devices file is closely related to the Dialers and Systems file.
Entry Format: TYPE LINE LINE2 CLASS DIALERTOKENPAIRS
Where:
TYPE Describes the type of link. For TCP/IP "links" we used the net_spec combined with the word "Device". This field
will be referenced by the third field in the Systems file. A protocol can also be
designated. For TCP/IP connections, use e,g.
LINE Contains the device name of the line (port) associated with the Device entry. In our example, we used ynet and
enet since these were the listener ports we defined.
LINE2 This is used for ACU type devices and will not be discussed here, thus a "" was placed in this field to signify not
used.
CLASS This again is used for ACU type devices and will not be discussed here, thus a "" was placed in this field to
signify not used.
DIALERTOKENPAIRS This contains the pairs of dialers and tokens. For TCP/IP connections, use "TLI \D tcp". This
will access the built in TLI (Transport Level Interface Network) and the token tcp that we placed in the Dialers file.
In our example, we entered the following two lines to the /etc/uucp/Devices file for both app0020 and app0021:
ynetDevice,eg ynet TLI \D tcp
enetDevice,eg enet TLI \D tcp
3) Set up the Permissions File
The Permissions file (/etc/uucp/Permissions) specifies the permissions that the remote systems have with respect to login,
file access, and command execution. Options are provided for restricting the remote
system's ability to request files and to receive files queued by the local site. Another option is available to specify the
commands that a remote site can execute on the local system.
It is beyond the scope of this document to go into security issues for UUCP. This information is explained in detail in the
NCR UNIX SVR4 Administrator Guide: Advanced Tasks manual (Section 15). We can show a basic setup that we used
just to allow the users uucp and nuucp to log into a system.
For our example, we put the following information into the Permissions file on app0020 and app0021:
LOGNAME=uucp:nuucp \
REQUEST=yes \
SENDFILES=yes \
CALLBACK=no \
READ=/usr/spool/uucppublic \
WRITE=/usr/spool/uucppublic \
NOREAD=/etc \
NOWRITE=/etc \
COMMANDS=rnews:rmail:uucp:lp:/usr/local/bin/ditroff \
MYNAME=app0021 put app0020 in app0020
NOTE: The parameter MYNAME is not discussed in the referenced documentation, however it is a very useful parameter.
It allows you to specify what name you would like to have your system known as. If this parameter is not specified, the
uname of the system will be used. The name of a system is passed during the initialization phase of a UUCP connection.
The calling system expects to receive back the name that was called (in the Systems file).
4) Set up the Systems file
The Systems file (/etc/uucp/Systems) contains information that both the cu and uucico (UUCP) need to establish a
communication link to a remote system. Each entry in the file represents a system that can be called by your system. A
particular system may have more than one entry in the Systems file. The additional entries represent alternative
communication paths that are tried in sequential order.
It is beyond the scope of this document to go into security issues for UUCP. This information is explained in detail in the
NCR UNIX SVR4 Administrator Guide: Advanced Tasks manual (Section 15).
In our example, the following entries were placed in the Systems file
for app0020:
app0021 Any ynetDevice \x00020ace8001c011
app0021 Any enetDevice \x00020ace84f26fac
For app0021, the following entries were placed in the Systems file:
app0020 Any ynetDevice,eg \x00020ace8001c010
app0020 Any enetDevice,eg \x00020ace84f26fab
NOTE: The format of the fields are explained in the Advanced Tasks Guide, however there are several items worth noting
here. The first field is the name of the system that you want to call. In our case, we
used the same name as the uname of the remote system. If you wish to use another name, the MYNAME parameter in the
remote system Permissions file must be set to the same name as used in the local systems Systems file.
The last field shown in our example is the RFS address format of the system that we are calling. This address is based on
the IP address of the remote host, which will be different based on the network interface that you wish to use. In our
example, there were two routes to each AP. The ynet and the enet interface. Thus we located the name of the remote host
in the /etc/hosts file and used rfsaddr to provide the RFS address format.
For app0020, the following commands/output were done:
# /usr/etc/rfsaddr h app0021
\x00020ace8001c011
# /usr/etc/rfsaddr h app0021_e
\x00020ace84f26fac
For app0021, the following commands/output were done:
# /usr/etc/rfsaddr h app0020
\x00020ace8001c010
# /usr/etc/rfsaddr h app0020_e
\x00020ace84f26fab
5) Assure that the users uucp and nuucp are setup in the /etc/passwd, /etc/shadow and /etc/groups files
The users uucp and nuucp usually come pre configured as users on your system. It is a good idea to verify this however.
In our example system, the following information was verified:
# grep "^uucp" /etc/passwd
uucp:x:5:5:0000uucp(0000):/usr/lib/uucp:
# grep "^uucp" /etc/shadow
uucp:NONE:8096::::::
# grep "^nuucp" /etc/passwd
nuucp:x:10:10:0000uucp(0000):/var/spool/uucppublic:/usr/lib/uucp/uucico
# grep "^nuucp" /etc/shadow
nuucp::8096::::::
# grep "uucp" /etc/group
uucp::5:root,uucp
All your systems that need to allow the uucp and nuucp users access must have the users defined similarly. If they are not
in these files, UUCP will not work. They can be added via the standard sysadm menus or by
using vi.
Section 2: Testing The UUCP Set Up
Testing your UUCP setup after completing the steps in section 1 of this document is a relatively simple procedure. For a
more complete write up of the test procedures and troubleshooting procedures see the NCR UNIX SVR4 Administrator
Guide: Advanced Tasks manual (Section 15).
The easiest way to test your setup is to use the Uutry command which is provided with the UUCP utilities.
Description: Uutry is a shell that is used to invoke uucico to call a remote site. Debugging is initially turned on and is set
to the default value of 5. The debugging output is put in the file /tmp/<system_name> and also to stdout. For more details,
see the man pages for Uutry.
To invoke Uutry, do the following:
# /usr/lib/uucp/Uutry <system name>
Where <system name> is the remote system that you wish to test communications with. This should be done for every
system that you have set up on each host that you have set up. Further, where you have defined multiple entries in the
Systems file for a given host, the entries should be commented out one at a time (put # in front of the line to comment out),
so that the next route to the remote system will be tested.
NOTE: After trying Uutry, the console you are on will hang in the process until it is sent a kill character (usually <del> or
<ctl c>). Also, once you have tried a connection once, a file is created in the
/var/spool/uucp/.Status directory for the remote host which will keep you from trying the Uutry to that system again for a
given time period. If you wish to try again immediately, simply remove the file in the
/var/spool/uucp/.Status directory.
Section 3: A Simple Shell For Automating UUCP Setup Over TCP/IP
During our investigation into the problems we were encountering with UUCP setup over TCP/IP, we wrote a simple shell
script to automate most of the setup. In fact, the only portion of the procedure in section 1 that this scrip does not address
is setting up the Permissions file (Section 1.3, Step 3) and setting up the Systems file (Section 1.3, Step 4).
NOTE: As with any shell, care should be taken when using this on your system. We know of several limitations for this
script.
Limitations:
A) This will not work in a DNS environment since we depended on the /etc/host file being local.
B) This script does not address all the aspects discussed in Section 1 of this document. Specifically it does not check for
preexisting listen processes discussed in Section 1.1. It also does not add/modify the
/etc/uucp/Systems or /etc/uucp/Permissions files.
C) This script may also produce duplicate listen port names if the network interface names are similar. Because the port
monitor listen name must be alphanumeric, this script removes any nonalphanumeric characters. This could produce
duplicate names. For instance, if there were two interface names, pnet and p_net, they would both end up having the port
listen name of pnet. If this happens, only the second port will be setup by this script.
#!/bin/ksh
ENDPOINTS=/tmp/endpoints.$$
echo "Creating S76uucpsetup rc2.d script"
##########################################################
# Start building rc script S76uucpsetup) to assure nodes
# are setup in /dev (could have been deleted
# after kernel relink). Also S76uucpsetup assures that
# /etc/netconfig has the required entries.
#
SETUPRC=/etc/init.d/uucpsetup
echo "#!/bin/ksh" > $SETUPRC
echo "# This script (S76uucpsetup) will " >> $SETUPRC
echo "# assure nodes for UUCP are setup after reboot " >> $SETUPRC
echo "# in case kernel has been rebuilt (could have " >> $SETUPRC
echo "# removed /dev when major/minor #s change on " >> $SETUPRC
echo "# pkgadd. Also assures proper entries are in " >> $SETUPRC
echo "# /etc/netconfig for uucp & listen daemons. " >> $SETUPRC
echo "echo \"Checking UUCP setup...\"" >> $SETUPRC
echo "ENDPOINTS=/tmp/endpoints.\$\$" >> $SETUPRC
echo "netstat i | egrep v \"^Name.*Address|Loopback\" | \\" \
>> $SETUPRC
echo " nawk '{ print \$3 }' > \$ENDPOINTS" >> $SETUPRC
echo "NETCONFIG=\`egrep \"^tcp\" /etc/netconfig\`" >> $SETUPRC
echo "while read NETWORK" >> $SETUPRC
echo "do" >> $SETUPRC
echo " #" >> $SETUPRC
echo " # port monitor tags must be alphanumeric, but stuff in \
/etc/networks" >> $SETUPRC
echo " # can be anything. This tries to weed out the nonalphanum \
stuff" >> $SETUPRC
echo " #" >> $SETUPRC
echo " ALPHA_NETWORK=\`echo \$NETWORK | sed 's/[^AZaz09]//g'\`" \
>> $SETUPRC
echo " NETWORK=\$ALPHA_NETWORK" >> $SETUPRC
echo " #" >> $SETUPRC
echo " # This sets up the network definitions in the /etc/netconfig" \
>> $SETUPRC
echo " # Database. " >> $SETUPRC
echo " #" >> $SETUPRC
echo " MY_NETCONFIG=\`echo \$NETCONFIG | sed \"s/^tcp/\$NETWORK/\"\`" \
>> $SETUPRC
echo " grep \"^\$MY_NETCONFIG\" /etc/netconfig >/dev/null 2>&1" \
>> $SETUPRC
echo " if [ \$? eq 1 ]" >> $SETUPRC
echo " then" >> $SETUPRC
echo " echo \$MY_NETCONFIG >> /etc/netconfig" >> $SETUPRC
echo " fi" >> $SETUPRC
echo " #" >> $SETUPRC
echo " # This checks for nodes in /dev for each network listener" \
>> $SETUPRC
echo " # (workaround for current prob w/ listener) " >> $SETUPRC
echo " #" >> $SETUPRC
echo " if [ ! c /dev/\$NETWORK ]" >> $SETUPRC
echo " then" >> $SETUPRC
echo " if [ c /dev/tcp ]" >> $SETUPRC
echo " then" >> $SETUPRC
echo " MAJMIN=/tmp/majmin" >> $SETUPRC
echo " ls la /dev/tcp | nawk '{print \$5 \" \" \$6}' \\" >> $SETUPRC
echo " | sed \"s/,//\" >\$MAJMIN" >> $SETUPRC
echo " while read MAJ MIN" >> $SETUPRC
echo " do" >> $SETUPRC
echo " #" >> SETUPRC
echo " # Create node for listener device" >> $SETUPRC
echo " #" >> $SETUPRC
echo " /sbin/mknod /dev/\$NETWORK c \$MAJ \$MIN" >> $SETUPRC
echo " /usr/bin/chmod 666 /dev/\$NETWORK" >> $SETUPRC
echo " done < \$MAJMIN" >> $SETUPRC
echo " rm f \$MAJMIN" >> $SETUPRC
echo " fi" >> $SETUPRC
echo " fi" >> $SETUPRC
echo "done < \$ENDPOINTS" >> $SETUPRC
echo "rm f \$ENDPOINTS" >> $SETUPRC
echo "echo \"Finished UUCP check\"" >> $SETUPRC
#
# Make link in /etc/rc2.d directory
#
chmod 766 /etc/init.d/uucpsetup
ln /etc/init.d/uucpsetup /etc/rc2.d/S76uucpsetup > /dev/null 2>&1
###########################################
# Done Building RC Script
###########################################
# Start creating UUCP setup
###########################################
echo "Starting UUCP setup..."
#
# Create file containing "Network" & "Address" of each network
# interface. Will be used to setup port monitors
#
netstat i | egrep v "^Name.*Address|Loopback" | \
nawk '{ print $3 " " $4 }' > $ENDPOINTS
#
#check to see if listen is defined in /etc/services. If not, add.
#
echo "\tChecking/Adding \"listen\" to /etc/services"
grep "listen" /etc/services > /dev/null 2>&1
if [ $? != 0 ]
then
echo 'listen 2766/tcp attlisten saflisten listener # listener' \
>> /etc/services
fi
#
# get listen port number
#
LISTEN_PORT=`egrep "^listen" /etc/services | awk '{ print $2; exit }' | \
sed 's,/.*,,g' `
LISTEN_PORT=${LISTEN_PORT:"2766"}
#
# Get "tcp" definition from /etc/netconfig Database
#
NETCONFIG=`egrep "^tcp" /etc/netconfig`
#
# Define the tcp entry in the /etc/uucp/Dialers file if required.
#
echo "\tChecking/Adding tcp entry in /etc/uucp/Dialers file."
grep "^tcp" /etc/uucp/Dialers > /dev/null 2>&1
if [ $? eq 1 ]
then
echo 'tcp "" "" NLPS:000:001:101\\N\\c' >>/etc/uucp/Dialers
fi
#
# NETWORK will be the name of the transport interface listener,
# and NAME is the entry in the host file for that interface for
# this machine.
#
while read NETWORK NAME
do
#
# port monitor tags must be alphanumeric, but stuff in /etc/networks
# can be anything. This tries to weed out the nonalphanum stuff
#
ALPHA_NETWORK=`echo $NETWORK | sed 's/[^AZaz09]//g'`
NETWORK=$ALPHA_NETWORK
#
# build listen address
#
LISTEN_ADDRESS=`/usr/etc/rfsaddr h $NAME p $LISTEN_PORT`
#
# check to see if the port monitor is listening on a previous address
#
if [ "$LISTEN_ADDRESS" != "`nlsadmin l $NETWORK`" ]
then
#
# remove all knowledge of the port monitor
#
echo "\tCreating $NETWORK listen address."
/usr/sbin/sacadm r p $NETWORK
rm rf /etc/saf/$NETWORK
fi
#
# start listen monitor and initialize if needed
#
sacadm l p $NETWORK > /dev/null 2>&1
if [ $? ne 0 ]
then
echo "\tAdding $NETWORK listen service... "
nlsadmin i $NETWORK
if [ $? eq 0 ]
then
/usr/bin/nlsadmin l $LISTEN_ADDRESS $NETWORK
if [ $? ne 0 ]
then
echo "Error: adding listen service and address"
fi
fi
fi
#
# start lp service This will setup lp service on listen port
#
pmadm l p $NETWORK s lp > /dev/null 2>&1
if [ $? ne 0 ]
then
echo "\tAdding lp service... "
pmadm a p $NETWORK s lp i root v `nlsadmin V` \
m `nlsadmin o /var/spool/lp/fifos/listenS5`
if [ $? ne 0 ]
then
echo "Error: adding lp service to port monitor"
fi
fi
#
# start uucico service
#
pmadm l p $NETWORK s 101 > /dev/null 2>&1
if [ $? ne 0 ]
then
echo "\tAdding uucico service... "
nlsadmin a 101 c "/usr/lib/uucp/uucico r 0 i TLI u uucp" \
y "uucp listener for net $NETWORK" $NETWORK
if [ $? ne 0 ]
then
echo "Error: adding uucicio service to port monitor"
fi
fi
#
# This sets up the network definitions in the /etc/netconfig
# Database.
#
echo "\tChecking/Adding $NETWORK to /etc/netconfig..."
MY_NETCONFIG=`echo $NETCONFIG | sed "s/^tcp/$NETWORK/"`
grep "^$MY_NETCONFIG" /etc/netconfig >/dev/null 2>&1
if [ $? eq 1 ]
then
echo $MY_NETCONFIG >> /etc/netconfig
fi
#
# This checks for nodes in /dev for each network listener
# and adds if required
#
echo "\tChecking/Adding /dev/$NETWORK..."
if [ ! c /dev/$NETWORK ]
then
if [ c /dev/tcp ]
then
MAJMIN=/tmp/majmin
ls la /dev/tcp | nawk '{print $5 " " $6}' | sed "s/,//">$MAJMIN
while read MAJ MIN
do
#
# Create node for listener device
#
/sbin/mknod /dev/$NETWORK c $MAJ $MIN
/usr/bin/chmod 666 /dev/$NETWORK
done < $MAJMIN
rm f $MAJMIN
fi
fi
#
# Check to see if listen port is running. If not, start
#
nlsadmin q $NETWORK
if [ $? eq 1 ]
then
echo "\tStarting $NETWORK listen deamon."
nlsadmin s $NETWORK > /dev/null 2>&1
if [ $? ne 0 ]
then
echo "Error: starting $NETWORK port monitor"
fi
fi
#
# Add the net_spec to the /etc/uucp/Devices file
#
echo "\tChecking/Adding Device file for $NETWORK entry."
grep "^$NETWORK" /etc/uucp/Devices >/dev/null 2>&1
if [ $? eq 1 ]
then
echo "Adding $NETWORK to Devices file."
echo $NETWORK"Device,eg "$NETWORK" TLI \D tcp" \
>>/etc/uucp/Devices
fi
done < $ENDPOINTS
rm f $ENDPOINTS
echo "UUCP setup completed..."
echo " "
echo "REMEMBER This script did not setup the /etc/uucp/Systems"
echo " nor /etc/uucp/Permissions files. You must set"
echo " these up by hand."
END OF HOW TO USE UNIX PROCEDURES