Cover V09, I02
Article

feb2000.tar


Questions and Answers

Jim McKinstry

 Q I have an NT server and Solaris 2.5.1. How does NT provide telnet service for Solaris? From NT, I can telnet to Solaris; but from Solaris, I cannot telnet to NT.

 A telnet to your Solaris box and run a ps -ef | grep inetd. You'll see something like:

root   139     1  0   Oct 18 ?        0:00 
/usr/sbin/inetd -s/inetd

is the Internet Services Daemon for UNIX. It controls all of the TCP/IP (i.e., telnet, ftp, etc.) connections into your machine. The services it handles are defined in /etc/inetd.conf. Check it out for more information.

Then, do a ps -ef | grep telnet, and you'll see something like:

root 15185 139 0 16:17:06 ? 0:00 in.telnetd

You may see more than one in.telnetd running, but they will all have the parent process (third column of the output) of “139” (or whatever your inetd PID is from the first ps command).

Next, do a ps -ef | grep 15185, where “15185” is the PID of your in.telnetd process, and you'll see something like:

root 15185   139  0 16:17:06 ?        0:00 in.telnetd
root 15187 15185  0 16:17:06 pts/5    0:00 -ksh

You'll see that your login shell (ksh in this case) was spawned by the in.telnetd session. In a nutshell, this is how a telnet connection works to a UNIX system -- a remote user telnets to the UNIX box. On the UNIX box, the inetd daemon (only one) receives the incoming request on port 23. inetd takes the request and checks the /etc/inet/services file to see what to do with it. /etc/inet/services has an entry like:

telnet          23/tcp

This says that any request received on port 23 is a telnet request. inetd then checks /etc/inetd.conf where there is a line like this:

telnet  stream  tcp     nowait  root    /usr/sbin/in.telnetd    in.telnetd

This basically says that if inetd receives a telnet request, then spawn /usr/sbin/in.telnetd. When you look at your NT system, you will not see an inetd or telnetd process running. NT does not provide (at least through revision 4.0) a telnetd service. The telnetd (the telnet daemon) for NT is available from third parties. A good one is NFS Maestro Package from Hummingbird Communications Ltd. The package provides a myriad of inetd style services and a full telnet and ftp daemon, as well as the ability to mount NFS shares.

 Q How do I backup complete raw image files to an external SCSI device using dd?

 A Try the following:

dd if=<input file>  of=<output file>

For example, to copy a whole disk (HP-UX) to tape:

dd if=/dev/rdsk/c0t3d0  of=/dev/rmt/0m

To copy a whole disk (Solaris) to tape:

dd if=/dev/rdsk/c0t3d0s2  of=/dev/rmt/0m

To copy a whole disk (HP-UX) to another disk:

dd if=/dev/rdsk/c0t3d0  of=/dev/rdsk/c0t4d0

To copy a whole disk (Solaris) to another disk:

dd if=/dev/rdsk/c0t3d0s2  of=/dev/rdsk/c0t4d0s2

 Q My etc/password file appears to be inoperable, but the system is running fine. I cannot log into the server to make changes. It is acting as my DNS server. Any suggestions?

 A It sounds like you need to boot from CD. After you are up from the CD, mount the filesystem that contains /etc. Then you need to either edit the passwd file by hand and fix the problem or recover a good passwd file from tape. If you are using a system where /etc/shadow is used, then you need to edit the shadow file to fix the problem. Once you are done, reboot and you should be able to log in. If you then don't know root's password (because you recovered an old password file), remove the password field for root while editing the password (or shadow) file. The root entry in /etc/shadow will look something like:

root:qQ5vhs6JFddRA:10830::::::

To remove the password, delete the qQ5vhs6JfddRA, and the line will look like:

root::10830::::::

If using only /etc/passwd the the root entry looks something like:

root:ciMwPzD28pGE2:0:3::/:/sbin/sh

To remove the password, delete the ciMwPzD28pGE2 and the line will look like:

root::0:3::/:/sbin/sh

 Q I have changed the IP addresses and subnet using the ifconfig command. However, after rebooting the system, the old ip addresses and subnet reappear. Any suggestions?

 A ifconfig only changes the information for the life of that boot. When you reboot, you go back to what was previously there. To permanently change the IP address and netmask, there's an easy way and a hard way. For HP-UX, you can use SAM (easy) or change the IP and netmask values in /etc/rc.config.d/netconf (hard). For Sun, you can use sys-unconfig (easy). When the system reboots, you will be prompted to reconfigure it. You can also check out the man page for sys-unconfig and do everything it does by hand (hard). I recommend the hard way. You'll learn a lot more about your system.

 Q How can I change the root password (e.g., id=0 gid=1)? I cannot change it in Solstice Admin Suite.

 A I may be really confused, but it sounds like all you need to do is to log in as root and type “passwd”.

 Q How can I convert the generic names (like sd19 and sd20) to device file names under Solaris 2.5? The output of sar is useless if I can't find out which disk has a problem!

 A Here's an example of how this works. Do a ls -l /dev/dsk/c0t0d0s2:

lrwxrwxrwx   1 root     root          48 Jun  4 15:19
/dev/dsk/c0t0d0s2 -> ../../devices/
sbus@2,0/QLGC,isp@1,10000/sd@0,0:c

The information that uniquely identifies this device is:

"sbus@2,0", "QLGC,isp@1,10000"  and sd@0,0

Now look in /etc/path_to_inst for this device. /etc/path_to_inst records mappings of physical device names to instance numbers. Type:

"grep sbus@2,0 /etc/path_to_inst | grep QLGC,isp@1,10000 | grep sd@0,0”

and you see:

"/sbus@2,0/QLGC,isp@1,10000/sd@0,0" 0 "sd"

The format is: “physical name”, instance number, and “driver binding name”. Notice that this device is “driver binding name” sd, and “instance number” 0, for a name of sd0.

Below is a script that will calculate this information for you. I've tested it on Solaris 2.5.1 and 2.6, but you may need to tweak it a little. It does not handle pseudo devices.

#!/bin/ksh
# Print out ssd and sd devices and their /dev/dsk/c?t?d?s2 counterparts.
# EX: ssd0 is /dev/dsk/c0t0d0s2

# Loop through each disk device in /dev/dsk.
for DEVICE in 'ls /dev/dsk/c*t*d*s2'
do
# for each device, grab some info that will uniquely identify the 
# device in the /etc/path_to_inst
  ls -l $DEVICE | awk -F'/' '{ print $7, $8, $NF }' | read info1 info2
info3

# Now grab the "driver binding name" ("sd" or "sdd") field and the
# "instance number"
  grep $info1 /etc/path_to_inst | grep $info2 | grep 'echo $info3
  | awk -F':' '{ print $1 }' '
  | awk '{ print substr($3,2,(length($3)-2))$2 }' | read SD_DEVICE

# Now print out the results
echo $SD_DEVICE is $DEVICE

done

Another solution is to install Rich Pettit's SymbEL Tools (RICHPse, RICHPsex, and ANCrules). Located in the example directory, /opt/RICHPse/examples, is a program called disks.se that will convert the names for you. Use /opt/RICHPse/bin/se disks.se to run it. The only problem is that this tool seems to only recognize disks with mounted filesystems on them. There are many other tools included in these packages that seem useful and should be examined. You can get these packages at:

http://www.sun.com/sun-on-net/performance/se3/ 

About the Author

Jim is a Technical Analyst specializing in UNIX. He has worked for IBM, Rite Aid, EDS, and is currently working for Sprint Paranet. He can be reached at: jrmckins@yahoo.com.