Cover V09, Ixx
Article

sep2000.tar


Questions and Answers

Jim McKinstry

I apologize to Advanced Computer & Network Corporation for not referencing their Web site as a source of benchmarking information in the July Q&A column. Please visit their Web site at: http://www.acnc.com/benchmarks.html to read their full write-up on benchmarks. Again, I apologize to AC&NC for my omission.

 Q If I have two partitions on my hard drive, is it possible to have Solaris 7 on both the partitions?

 A Yes. You can also have Solaris on one partition and any other operating system you’d like on the other. There are many ways to do this. I suggest partitioning the disk with as many partitions as you need (at least three — one for each Solaris install and one for a shared SWAP area).

Assuming that you installed Solaris on slice 3 and slice 4, you need to use the following commands to boot: boot disk:d to boot from slice 3, and boot disk:e to boot from slice 4.

Just configure each Solaris install to use the slice you set aside for SWAP (or use slice 1 and Solaris will automatically use it).

 Q I want root to be able to telnet into my system. How do I allow this?

 A While this is not a good idea, since telnet will send a password in clear-text (see below), here’s how you do it:

1. Look in the /etc/default/login file for the line that starts “CONSOLE” (all upper case).

2. Delete the CONSOLE=/dev/console line.

 Q How do I tell how much disk space a user is using?

 A Use quot -af | grep username. Quot is the facility that displays the number of blocks (1024 bytes) in the named filesystem currently owned by each user. The -a flag will check all of the mounted filesystems. The -f flag displays the number of files as well as space owned by each user. The grep username will only display the line for the user you are reviewing. Leave that out if you want to see the report for every user on the system.

 Q I’ve been asked to “lock down” my server. Where should I start?

 A By “lock down”, I’m assuming that you want to control the network access to your system. Start by editing /etc/inetd.conf and removing (or commenting out) all of the entries that you don’t need (finger, all of the r: commands, etc.). The inetd.conf file contains the list of servers that inetd invokes when it receives an Internet request over a socket. Run a kill -HUP against the inetd PID to re-read the inetd.conf file. You should also consider installing ssh to replace telnet. You can also install tcp_wrappers to limit access to the services that you leave in inetd.conf. You can download tcp_wrappers from many sites on the Web.

 Q How do I add a new hard drive to my Sparc-based Solaris system?

 A Assuming that you are using vanilla Solaris, here are the steps:

1. Shutdown and power-off the system.

2. Install the drive and restart the system.

3. Find out the address of the drive:

• Press STOP-A
• At the OK prompt, type probe-scsi. (This will list all SCSI devices on the system.)
• Find the new drive in the list and note its information. 4. Type boot -r. When the system comes up, Solaris will be able to use the drive.

5. Login as root and type “format”. Select the new drive. The drives are listed as c(controller number), t(target id or SCSI id), d(disk number). (Example: c0t0d0.)

6. Next, type “partition”. Partition the drive as required. Always leave partition (or slice) 2 alone. Slice 2 represents the whole disk.

7. Type “print” to list the current partitions and check your work.

8. Exit out of the format command.

9. From the command prompt, create a filesystem: newfs /dev/dsk/DRIVE-ADDRESS (i.e., newfs /dev/dsk/c2t4d0s3).

10. Now make the mount point for the new filesystem: mkdir <directory-name> (i.e., mkdir /new_disk).

11. Mount the new filesystem: mount /dev/dsk/DRIVE-ADDRESS <directory-name> (i.e., mount /dev/dsk/c2t4d0s3 /new_disk).

12. Add the new entry to your /etc/vfstab file so that the filesystem will be mounted at each reboot (i.e., /dev/dsk/c2t4d0s3 /dev/rdsk/c2t4d0s3 /new_disk ufs 1 yes -).

 Q How do I set up user disk quotas?

 A

1. Edit the file /etc/vfstab in a text edit. For the filesystem on which you want quotas, add the word “quota” to the mount options:

/dev/dsk/c2t4d0s3 /dev/rdsk/c2t4d0s3  \
   /new_disk ufs 1 yes quota
2. Create a file called “quotas” in the “root” of the filesystem you want to monitor:

touch /new_disk/quotas
3. Use edquota to edit the quota for a user. To edit the quota for the user “Bubba”:

edquota bubba
4. Set the soft and hard quotas you want for the user (in kilobytes). Do the same for inodes. Soft is the limit where a user receives a warning when he exceeds the limit. Hard is the limit where the user can no longer save files when he hits the limit. To edit the settings of a user with a soft limit of 100 MB, and a hard limit of 150 MB, with 1 inode per block:

fs /new_disk blocks (soft=102400, hard=153600) \
   inodes (soft=1024, hard=1536)
5. Run quotacheck to implement the new quotas:

quotacheck /new_disk
6. To apply the same quotas out to many users, use the -p flap to edquota. For example, to push Bubba’s quota out to Tom, Dick, and Harry, use the following:

edquota -p bubba tom dick harry
7. To see usage reports on quotas, use the command

quotacheck -a.
 Q I keep getting timeout errors from Sendmail. How do I fix this?

 A Sometimes the default TCP/IP abort interval timeout in Solaris 2.x (2 minutes), is too short, and some programs timeout if the response is too slow. To increase this timeout period, use:

/usr/sbin/ndd -set /dev/tcp   \
   tcp_ip_abort_interval 600000
Units are in microseconds (600000 microseconds equals 10 minutes).

Solaris allows you to tune, tweak, set, and reset various parameters related to the TCP/IP stack while the system is running (as opposed to a kernel rebuild). ndd is used to get and set some kernel driver parameters. For example, to see which parameters the TCP driver supports, use:

ndd /dev/tcp \?
To turn IP Forwarding off, which is good to do if you have two network cards in one system and you don’t want the server to route any packets between the two networks:

ndd -set /dev/ip ip_forwarding 0
 Q I’ve always heard that telnet is not secure. Why?

 A The biggest reason telnet is not considered secure is that it sends your password across the network in clear-text, which is really bad if you are root. To see this, use snoop. snoop is a command that puts your system’s network card in promiscuous mode. By being in promiscuous mode, snoop captures all packets on you network, in either real time, or saved to a file. In real-time mode, the data flies across your screen too fast to read. To do some serious analysis, capture your network traffic to a file.

To capture data to a file, the command is:

snoop -o <filename>
To see the telnet clear-text password problem, run snoop -v -o <filename> on your Sun workstation. telnet to another server and log in. Stop your snoop command (<ctrl-c). To view the file, use snoop -v -i <filename>. You should be able to find the packet that contains your password in readable text. Do the same test using ssh and you should not find your password in the snoop output.

 Q I’m using automounter to mount my users’ home directories on demand (/home). Now the mounts are not working. What is the problem?

 A The automounter is a program that automatically does mounts and unmounts of designated NFS partitions. It has maps that list what directories it controls in this manner. Automounted directories start out unmounted, and are mounted when someone tries to access them. After a certain idle time, the automounted directory is unmounted.

There are two types of automounter maps: direct and indirect. A direct map lists a set of unrelated mount points that may be spread out across the filesystem. A complete path (i.e., /usr/local/bin or /usr/man) is listed in the map as a mount point. An indirect map sets aside a directory, and mounts everything in the map into that directory (i.e., the auto.home map sets aside /home, and everything in the auto.home map is mounted under that directory).

It is common for automounted mounts to fail because something has been put in the directory of the problem client. Make sure that the /home directory is totally empty on the client before the automounter is started.

 Q I have a file system that is showing 100% full in df -k output. How do I find the files that filled the file system?

 A The best way to find the large files is to cd into the file system that is full (e.g., cd /var). Now run the du -s * command. The output of du will show the size of directories and files in 512 kb blocks. If there are no odd-looking large files in that directory, look into each directory that was listed, starting with the largest. In the case of the example (/var), /var/adm will probably be one of the largest. cd to /var/adm and do the du -s * command again to find large files, or cd to the largest directory. Keep searching. It takes some practice to find the offensive file(s).

 Q When I ftp a file from my Windows workstation to my UNIX box the file appears corrupted. Why is this happening?

 A What you’re probably seeing is the ^M at the end of each line. This is because the file is in DOS format and not UNIX (ISO) format. Use the dos2unix command to convert the file to UNIX format after you ftp it. You will also note that if you print UNIX ascii files to some network printers they just print out as one big line. This is because the printer expects a DOS-formatted file. To print correctly, do something like this: unix2dos <unix-file> | lp. This command converts the file to DOS and sends it to the printer.

 Q I was editing a file (using vi) when my Linux box crashed (OK, it didn’t crash, I accidentally switched off the power supply). Did I lose all of my work?

 A Maybe not. Try vi -r <file name>. The -r flag will restore your file in the case of a crash. If this command works, then make sure that you do a write (:w) as quickly as possible so that you don’t risk losing the work again.

About the Author

Jim McKinstry is a Senior Sales Engineer for MTI Technology Corporation (www.mti.com). MTI is a leading international provider of data storage management products and services. He can be reached at: jrmckins@yahoo.com.