HP-UX Tips

  1. Is there a "defrag" on UNIX?
  2. Starting/Stopping DTC's / DDFA in HP-UX 10
  3. HP-UX 10.x System Info Script
  4. Setting up routing
  5. Patch Cleanup
  6. Patch Frequently Asked Questions
  7. Fbackup/Frecover
  8. HP-UX telnet / pty users
  9. HP-UX 11.x info
  10. Setting up a remote console
  11. Using HP-UX 10.20 as DCHP server for Win95 clients
  12. Extending the root partition
  13. Retreiving data from an old root disk
  14. HP Certification help
  15. IPD Contains Duplicate Definitions for Products
  16. Determine block size of logical volume
  17. Replacing a boot disk and keeping the old info
  18. Altering the baud rate of a serial interface
  19. HP-UX Mailing List
  20. swinstall not finding target
  21. Using both DNS and /etc/hosts
  22. Patch install hangs
  23. Adding new devices
  24. swinstall not finding target
  25. Limiting the size of core dumps
  26. Adding additional interfaces to a LAN
  27. Stop logging of messages in syslog
  28. Finding ports not listed in /etc/services
  29. How to add a jetadmin printer from command line
  30. Converting /usr to vxfs
  31. Wiping a hard disk
  32. FTP: Access Denied
  33. Finding the MAC address
  34. Getting rid of stale nfs file handles
  35. FTP umask setting
  36. Copying printers between servers
  37. Entering username and passwd with CAPS LOCK
  38. Is a system in trusted mode?
  39. Mounting a filesystem in a recovery shell
  40. Clearing the /var/opt/hparray logs

1. Is there a "defrag" on UNIX?

For HFS filesystem:
HP-UX experts say that HFS filesystem was designed for optimum performance. It's sort of auto-defragmenting filesystem.
But, if you still insist on defragmentation, you have some possibilities:

  1. Backup entire filesystem
    Erase all files from that filesystem
    Restore entire filesystem (it's rather funny, but works good & requires a lot of time)
  2. Use standard HP-UX decompression utility (unfortunatelly, dcopy assumes you have a spare, identically sized filesystem available :( )
  3. Buy product called DISK_PAK (from EagleSoft, http://www.eaglesoft.com)

For VxFS (JFS) filesystem:
You need to buy additional AdvancedJFS (Online JFS) product from Hewlett-Packard. According to some people it is really worth the money; it allows you to get the full functionality of JFS (VXFS) - files/dirs stats, on-line backup, on-line extend/shrink file system (make sure you install the patches !), online (background) defrag.
If you already have this product check man page for 'fsadm' command.


2. Starting/Stopping DTC's / DDFA in HP-UX 10

/etc/rc.config.d/dtcmgr START_DTCMGR=1
/etc/rc.config.d/netdaemons START_RBOOTD=1

To check that the correct daemons are running when the system comes up, you can check the end of the following log files:

...which should say "INITIALIZATION COMPLETE".

The following daemons should be running when DTC's are up:

To disable DTC's, simply flag /etc/rc.config.d/dtcmgr:

...This stops them from coming up when you reboot. Simply change it back to 1 then reboot to restart the DTC daemon.You can also stop the daemons while the system is up (instead of booting) by running:


3. HP-UX 10.x System Info Script

Here is a script to gather system information on HP-UX 10.x systems: dumpsys.hp10


4. Setting up routing

These are the steps for setting up routing on HP-UX.
I will give the IP address to the router for this example.

Run the command: route add default 1 to initially add the router for all systems.

To keep this information after a reboot edit the file /etc/rc.config.d/netconf

    add the IP address to ROUTE_GATEWAY
    change ROUTE_COUNT to 1


5. Patch Cleanup
From HP

There is a utility under /usr/sbin and it is called 'cleanup'. It provides the following functionality for 10.X patch management:

Remove superseded patches from the system to reclaim space in /var. Queries the user re trimming SD logfiles as well.

/usr/sbin/cleanup -F
Forces the removal of ALL Patch backups to reclaim space in /var (you cannot back out a patch out after this).

/usr/sbin/cleanup -t
Trim SD logfiles /var/adm/sw*.log to the most recent 5 entries.

/usr/sbin/cleanup -i
Remove overwritten patch entries from the SDUX IPD.

/usr/sbin/cleanup -d [absolute path to software depot]
Removes superseded patches from a software depot.


6. Patch Frequently Asked Questions
From HP


7. Fbackup/Frecover

To backup use: /usr/sbin/fbackup -0v -f /dev/rmt/0m -i /

Recover command (absolute): /usr/sbin/frecover -xv -f /dev/rmt/0m -i /path[/file]
To do a relative restore using frecover you need BOTH -x and -X, ie -xvX


8. HP-UX telnet / pty users

To increase the number of telnet users a system can have, the npty kernel parameter needs to be altered. However, HP-UX requires "slave" and "master" pty devices for each telnet user. These devices are used logically as two ends of a pipe - they need to be there so HP-UX can allocate a tty device to a new telnet user.

To create the required master and slave device files, executed the command:
     insf -d pty -n 120


9. HP-UX 11.x info

This is intended as a quick summary of the new features and functions incorporated into HP-UX 11.

64bit VS 32bit

HP-UX 11.x is 64bit.
A 32 bit version can also be installed for hardware that doesn't support 64 bit.
Currently some D, K and T class servers support 64bit.
The new V class server is designed with HP-UX 11.x specifically in mind and doesn't support HP-UX 10.x / 32bit.
HP-UX11.x 64bit will still run 32 bit applications, but obviously vice versa does not apply.

Upgrading to HP-UX 11

HP-UX can be upgraded to release 11.x from 10.20 or 10.30.
You can also upgrade to HP-UX 11.x from 10.01/10.10, but this restricts you to the 32bit version of HP-UX 11.


Software Transition Kit is a new tool designed to help you move C/C++/script code over to 64bit.


NIS+, a new version of the Networking Information Service (yellow pages), has been added. This has enhancements to security, administration and ability to scale larger networks.
lanconfig and ifalias no longer exist - ifconfig, lanadmin, lanscan and netstat have been enhanced.

DLKM (Dynamically Loadable Kernel Modules)

HP-UX has a new method for updating the kernel in order to facilitate dynamic changes for kernel modules.


Software update and maintenance has been signifcantly enhanced.
Commands such as swlist now have a GUI-like interface.
Patch management has been significantly improved:
  • Ability to rollback O/S patches
  • Ability to apply patches based on software installed already

  • Ignite/UX - An enhanced program to install HP-UX, replacing the previous method for HP-UX installation (cold install).

    System Recovery

    A new make_recovery command creates bootable system images (similar to the AIX mksysb command).
    check_recovery lets you know if make_recovery needs to be executed again.
    Dump devices can be dynamicaly configured.


    10. Setting up a remote console

    This is intended to describe the procedure for setting up a remote console for the S800.

    The remote console allows Hewlett-Packard to perform remote support for your machine by enabling a remote or parallel console.

    In order to configure a remote console, you will need an HP support modem that is connected on port 7 of the MUX or MDP. Alternatively, the modem can be connected to the back of the box on the Access Port.

    In addition, please ensure that a 40233A cable is being used.

    Enabling the Remote Console
    Make sure that you are using the system console, and then follow this procedure:
    1. Issue a <CTRL-B> from the console:
      This should return the:
      prompt, as well as a line on the bottom of the screen similar to this:
          RUN F01F REMOTE : disabled inactive multiple ACCESS FAULT : 00

    2. Check the access configuration, by entering the following command at the CM> prompt:
      This will return the following:
          current terminal mode identification : HP mode terminal do you wish to change it ? (Y/[N]) : _

      If you choose N, you will see the following information:
        current remote support modem port configuration :
            Bit rate : 9600 bits/sec
            Protocol : Bell
            System Identification : 'hostname'
        do you wish to change configuration ? (Y/[N]) : _

      Make sure that your settings accurately reflect:
          the same speed as your modem (eg. 9600)
          that the protocol is set to Bell
          that the system name refers to the hostname of the system that you're working on
      If these settings are not correct, modify them

    3. To enable remote access, enter the following command from the CM> prompt:
      This will return the following information:
        current remote console access configuration :
            remote CS : Enabled
            Mode : Multiple
            Password : test
            Password Faults : 03
        do you wish to change configuration ? (Y/[N]) : _

      The password option allows you to set passwords to provide additional security by prompting a user for a password prior to gaining access.

      If all these fields are appropriately set, do not change the configuration.

      You will now see the following message displayed :
        Remote console is now enabled.

      The status bar at the bottom of the screen should now indicate that remote access is enabled but still inactive:
        RUN F01F REMOTE : enabled inactive multiple ACCESS FAULT : 00

      Once you connect to the console via modem, it will change to ACTIVE.

    4. Issue a break signal to toggle between the remote and local console. This will now allow the remote connection to gain control of the console.

    5. Return to console mode be entering this command at the CM> prompt:
      Note that you must hit the key twice.
    There are a variety of other useful commands that can be executed from the CM > prompt. In order to display the different commands that are available, type HELP at the CM> prompt.


    11. Using HP-UX 10.20 as DCHP server for Win95 clients

    How do you get the DHCP server to pass the default gateway and DNS information to its clients?

    The solution is to use the sample file, located in /usr/newconfig/etc/dhcptab, copy it to /etc/dhcptab, and edit it according to your wants and needs.


    12. Extending the root partition

    How do I extend (enlarge) the root partition which is located on a logical volume, the problem being that you can't umount the root partition.

    Here are 3 solutions to this commonly asked problem.

    Solution 1:

    One can purchase HP IgniteUX which will also do the job, alas after paying money for this product.

    Solution 2:

    Remove all things that are not needed on the root partition so you create additional space, e.g. clean up /tmp, symlink various files and/or directories, etc and create the space you need in this way.

    Solution 3:

    If you are using LVM there is a work around to extend the root LV.

    Boot the system in single user mode and extend the root using the lvextend command and it will extend the root logical volume.

    Make sure that the space to extend the root LV is available in the same disk as continuous physical extents because the root volume allocation poicy must be contigous.

    If the adjacent physical extents are occupied by any other LV move that logical volume to some other disk using pvmove command.
    #pvmove -n /dev/vg00/lvolx /dev/dsk/c0txd0 /dev/dsk/c0txd0

    Shutdown the machine and interrupt the normal boot process by pressing any key if it is a S800 system and if it is S700 use "esc" key.

    From the boot admin prompt type boot pri isl you will get the isl prompt
    ISL> hpux -lm

    This will take you to the logical volume maintanence mode. Don't try to mount any logical volume and don't switch to multiuser mode or a different runlevel.

    The root LV will now be mounted on /dev/root instead of /dev/vg00/lvolx

    Now you can execute the extendfs command on the root logical volume:
    # extendfs -F hfs /dev/vg00/rlvolx

    Note down the alternate superblock locations and reboot the macine using
    #reboot -n -------------- DONT MISS THIS STEP.
    This will cause the system to not sync the old superblock back to the filesystem and damage it.

    When you boot the system normally now you will get all the allocated space for the root filesystem.

    Now you will notice that the root volume is still mounted on /dev/root rather than /dev/vg00/lvolx. To correct this you remove the /etc/mnttab and you will find bdf now displays the correct logical volume.


    13. Retreiving data from an old root disk


    Original root disk: 4 Gb LVM/HFS SCSI ID 6
    New root disk, 4Gb LVM/HFS SCSI ID 6 with a freshly installed HP-UX.

    We want the system to run with (only) the new disk, but there is data on the first disk that have to be transferred from the original.


    Boot from disk one with ID 6. Break the boot process and interact with IPL. Enter the boot string
    hpux -lm stand/vmunix -is
    Issue the commands: pvck -y /dev/dsk/c0t6d0 and vgchange -a n vg00 to prepare the original disk
    Halt the system
    Change SCSI ID of the original disk from 6 to any free ID, say 5
    Connect both disks then power on
    Boot from the new disk with ID 6. Break the boot process and interact with IPL. Enter the boot string
    hpux -lm /stand/vmunix -is
    mkdir /dev/vg0x
    mknod /dev/vg0x/group c 64 0x010000
    vgimport -v vg0x /dev/dsk/c0t5d0
    vgchange -a y vg0x
    mount /<mountpoint> /dev/vg0x/lvolx


    What this does is allow you to change the volume group of the original root disk from vg00 to vg0x. You can then vgimport this and mount the old file systems to get the data you need.

    A much simpler method is to back up the data you want saved before you replace the old disk!


    14. HP Certification help

    Here are some tips on studying for HP-UX Certification:

    1. Get the sample questionnaire from the HP web site and work it out. Only very few questions will come from that.
    2. Take online seminar from HP ( 2 hours ) vist the following site
    3. Read HP-UX system administration manual page to page (HFS,JFS,Startup,Shutdown, boot lv preparation,etc.) It will of great help.
    4. Read HP-UX install & configuring Internet services ( DNS,NTP, Subnet, patch)
    5. Visit docs.hp.com for the topics not covered in these two books.
    6. Fundamentals of unix ( shell scripts, Vi ) ,, general unix knowledge if enough.

    Prepare answers to the following questions:

    1. Default packet size for ping
    2. How many servers (maximum) can be specified in /etc/resolv.conf ?
    3. When you create a file in unix, by default what permissions will be applied to it? How do you change this setup?
    4. Can a non-root user influence the job priority?
    5. How to display all the lines in a file not matching with a string
    6. How does jfs filesystem write into log file, i.e before updating on the disk or after updating?
    7. How do you supply a cron job
    8. Significance of at.allow, at.deny and their priority
    9. What will linkloop command do?
    10. Which command will show socket status?
    11. How much time does a client wait if none of the servers specified in /etc/resolv.conf are responding for name query?
    12. How do you disable or enable ARPA/BSD services
    13. Significance of /var/adm/inetd.sec
    14. For a given subnet mask ,how may hosts can be incorporated in a subnet.
    15. What subnet mask should be assigned to a network to get a required number of hosts in a subnet?
    16. What is fsck -o full,nolog used for?
    17. NFS export options
    18. How do you setup secondary DNS server
    19. What daemon will run only on primary NIS server?
    20. How do you update maps on secondary NIS?
    21. What is stale file handle error in NFS?
    22. What is command line argument in shell scripting?
    23. What is syntax of adding a new route?
    24. Can NIS work with out NFS ?. Vice versa?
    25. IS TCP/IP needed for NFS, NIS
    26. What does zz and wq mean in vi
    27. How do you combine results of two commands, ( e.g.. date + id ) using shell script.
    28. What is the effect of /etc./hosts.equiv on root user
    29. How do you do a full fsck on vxfs ( fsck -o )
    30. Can fsck be used for hfs & vxfs ( yes )
    31. How do you find available size for creating lvm ( vgdisplay)
    32. What can NOT be done using SAM.
    33. Run level for NFS (3)
    34. What is the FS type for /stand ( hfs )
    35. What command for listing pathces installed.
    36. Steps involved in building new kernal.
    37. Steps involved in extending online jfs ( no umount required)
    38. Default hp-ux shell ( posix)
    39. How do you list & create special files ( mksf, lssf)
    40. TFTP, bootp


    15. IPD Contains Duplicate Definitions for Products

    cleanup or cleanup -i work great if you have an IPD that is not corrupt. However you will have to do the following for a corrupt IPD:

    1. cd /var/adm/sw/products directory and look for duplicate product directories. These have .2 at the end of the directory name. Also look at the pfiles/INDEX files in both directories to verify they really were the same. Don't always assume that a .2 directory is a duplicate, however. You'll have to verify that the directories are incorrect by looking at the contents of them.
    2. Assuming that all of the .2's were incorrect entries in the IPD, move these directories to a temporary location.
    3. mv INDEX INDEX.OLD - this is the real IPD, built from the directories
    4. vi void.psf - create a package specification file with the following in it.
      tag void
      tag void
    5. swpackage -s void.psf - create a void package
    6. swinstall void - install the void package. This command actually senses the fact that the INDEX file no longer exists, and rebuilds the IPD from the directories in /var/adm/sw/products. Obviously, it will only be as accurate as what is in that directory structure, so great care must be taken to ensure you remove the right stuff.
    7. After swinstall completes, do a 'swlist -a state -l files | more' to verify all the file sets are configured. Also, do 'swlist -l product' and/or 'swlist -l fileset' to verify all your products and fileset are installed properly. If you really want to feel safe, I would suggest these commands be performed prior doing anything and that way you have hard copy of what the IPD looked like before it was touched.


    16. Determine block size of logical volume

    To determine the block size of a logical volume's read/write buffers run:
    fstyp -v {disk/lvol}


    17. Replacing a boot disk and keeping the old info

    The easy way is to use Ignite/UX, but if you don't have that:

    Manual procedure:

    1. Find an available Volume Group number:
      # ll /dev/*/group

      crw-r----- ... 64 0x000000 Oct 8 1996 /dev/vg00/group
      crw-rw-rw- ... 64 0x010000 Oct 30 1996 /dev/vg01/group
      crw-r--r-- ... 64 0x020000 Oct 30 1996 /dev/vg02/group
      crw-r--r-- ... 64 0x020000 Oct 30 1996 /dev/vgtest/group
      the two hex digits after the "0x" are the VG number, 00,01,02 in the above listing from my system, so "03" would be the logical choice.
    2. Create a new VG
      1. mkdir /dev/vgboot
      2. mknod /dev/vgboot/group c 64 0x030000
        Note the new VG number!
      3. pvcreate -B /dev/rdsk/cItTd0
        Make LVM disk and reserve boot area
      4. vgcreate vgboot /dev/dsk/cItTd0
    3. Put LIF boot stuff and AUTO boot string on it.
      1. mkboot /dev/rdsk/cItTd0
      2. copy any other LIF stuff for f in `lifls /dev/rdsk/c0t6d0` ;
        do lifcp /dev/rdsk/c0t6d0:$f /dev/rdsk/cItTd0:$f ;
        (assuming that your current boot disk is /dev/rdsk/c0t6d0)
      3. mkboot -a "hpux (;0)/stand/vmunix" /dev/rdsk/cItTd0
    4. Create your logical volumes on the new disk that correspond to the LVs on the current root disk: lvcreate -l 40 -n stand -r n -C y /dev/vgboot
      lvcreate -l 300 -n swap -r n -C y /dev/vgboot
      lvcreate -l 48 -n root -r n -C y /dev/vgboot
      (note the contiguous allocation and no BAD-block-relocate)
      lvcreate -l 400 -n usr /dev/vgboot
      lvcreate -l 100 -n tmp /dev/vgboot
      lvcreate -l 200 -n opt /dev/vgboot
      You can take this opportunity to adjust the sizes as you wish.
    5. Create filesystems on the new LVs created in 3., above newfs -F hfs /dev/vgboot/rstand
      newfs -F vxfs /dev/vgboot/rroot
      newfs -F vxfs /dev/vgboot/rusr
      newfs -F vxfs /dev/vgboot/rtmp
      Note: here, that you have the opportunity to make root and the other "system" filesystems JFS (Journaled FS), which is highly recommended. /stand must remain HFS
    6. mount the new filesystems into temporary directories
      1. mkdir /tmp_mnt
        mkdir /tmp_mnt/root
        mkdir /tmp_mnt/usr
        mkdir /tmp_mnt/tmp
      2. mount /dev/vgboot/root /tmp_mnt/root
        mount /dev/vgboot/usr /tmp_mnt/usr
        mount /dev/vgboot/usr /tmp_mnt/tmp
      3. Set permissions on the root directory of each filesystem the same as is currently set: chmod 755 /tmp_mnt/root ( or whatever
        chmod 555 /tmp_mnt/usr you currently have)
        *** chmod 777 /tmp_mnt/tmp
        NOTE : You probably will not be copying /tmp,
        # chmod 777 /tmp_mnt/tmp
    7. now copy the filesystems:
      1. use 'cpio' on root filesystem:
        cd / ; find . -xdev -hidden | cpio -pdmux /tmp_mnt/root
      2. I prefer fbackup for the others (it gets ACLs):
        (cd /; fbackup -i stand -f -) | (cd /tmp_mnt; frecover -r -f -)
        (cd /; fbackup -i var -f -) | (cd /tmp_mnt; frecover -r -f -)
    8. update BDRA for vgboot PVs:
      1. lvlnboot -r /dev/vgboot/root /dev/vgboot
        lvlnboot -b /dev/vgboot/stand /dev/vgboot
        lvlnboot -s /dev/vgboot/swap /dev/vgboot
      2. Check config:
        lvlnboot -v vgboot
        Boot Definitions for Volume Group /dev/vgboot:
        Physical Volumes belonging in Root Volume Group:
        /dev/dsk/cItTd0 -- Boot Disk
        Root: root on: /dev/dsk/cItTd0
        Swap: swap on: /dev/dsk/cItTd0
        No Dump Logical Volume configured
    9. Update the fstab file on the new root filesystem to reflect the new logical volume names, particularly the VG portion thereof:
      vi /tmp_mnt/root/etc/fstab
      /dev/vgboot/stand /stand hfs defaults 0 1
      /dev/vgboot/swap ... swap pri=1 0 2
      /dev/vgboot/root / vxfs rw,suid,delaylog,datainlog 0 2
      /dev/vgboot/usr /usr vxfs rw,suid,delaylog,datainlog 0 2
    10. Boot off the new disk to see if it works !!!!
      You'll have to interrupt the boot process and specify the path to the new disk as the boot device.


    18. Altering the baud rate of a serial interface


    How can I permanently set the baud rate of a serial port? Every time I set it and then check it, it is set at 300 baud.


    Execute the following two commands:
    1. nohup sleep n < tty_port &
    2. stty baud_rate < tty_port
    1. n is a large number, for example, 999999999. This sleep command holds the port open for n seconds.
    2. tty_port is a serial device file, such as /dev/tty01.
    3. baud_rate is the speed at which data will be transmitted over the line, such as 1200, 2400, 9600 or 19200


    19. HP-UX Mailing List

    The HP-UX mailing list can be found at: majordomo@dutchworks.nl
    Place one of the following in the body of the message:
       subscribe hpux-admin email-address
       subscribe hpux-admin-digest email-address


    20. swinstall not finding target

    swinstall needs to be able to do a reverse lookup of the hostname. If DNS is not resolving properly try to rename /etc/resolv.conf and ensure that /etc/hosts has a fully qualified domain name. If this still does not work try to restart swagentd:
       # /sbin/init.d/swagentd stop
       # /sbin/init.d/swagentd start

    If you have had to break the install part way through you may need to remove the file in /var/adm/sw/products/swlock.


    21. Using both DNS and /etc/hosts

    To run both DNS and /etc/hosts you need to set up the /etc/nsswitch.conf file. The easiest way is through SAM, but it can be done by adding the line:
    hosts: files [NOTFOUND=continue UNAVAIL=continue TRYAGIAN=continue] dns
    to nsswitch.conf.


    22. Patch install hangs

    If trying to install a patch on HP-UX 10.20 and the system just hangs, check to see if MeasureWare is running.
    The MeasureWare Agent often hangs the swinstall process at the Analysis stage.

    First you will need to kill the swinstall.
    Remember to remove the lock file: /var/adm/sw/products/swlock.
    Next disable MeasureWare via "mwa stop".

    You should now be able to install the patch.
    Finally, restart MeasureWare with "mwa start" to restart.

    You may also find that the


    23. Adding new devices

    When adding new devices, remember to check the kernel subsystem (using SAM) and ensure there is kernel support for the device.


    24. swinstall not finding target

    swinstall uses an IP lookup to determine the hostname.
    For swinstall to work correctly you need to be able to do an nslookup of the IP address.
    If you are using /etc/hosts, fix the problem.
    If you are using DNS you can either fix the DNS entry or temporarily disable DNS by renaming /etc/resolv.conf.
    After the nslookup has been resolved do an /sbin/init.d/swagentd stop/start.


    25. Limiting the size of core dumps

    To completely suppress core dumps:

    Bourne-style shells: "ulimit -c 0"
    C-style shells: "limit coredumpsize 0"

    If you want to limit dumps to a specific size, specify a number instead of 0, in blocks for Bourne-style shells, or kilobytes for C-style shells.


    26. Adding additional interfaces to a LAN

    First you need to install patch PHNE_12492 to get a command called ifalias. Once you have that patch installed, do the following to add an additional IP:
        ifalias lan0 add <ip address>

    However, this doesn't stick after a reboot. There is a script to fix this posted in the HP-UX mailling list archive at:


    27. Stop logging of messages in syslog

    I had a problem trying to stop ftp messages being logged to /var/adm/syslog/syslog.log. Initially I tried playing with /etc/syslog.conf but was pointed in the right direction by the list. The actual file to edit was /etc/inetd.conf. Check for a -l option. Removing the -l should stop the logging. Use inetd -c to re-read the config file.


    28. Finding ports not listed in /etc/services

    To find open ports that are not listed in /etc/services try using lsof to find out exactly what it is.
    You can get lsof from the HP porting and archive centre at http://hpux.cae.wisc.edu/.

    Try this:
    lsof -i TCP|grep ":<port number>"
    ...to get the image name and PID of the offending process, then just use ps to find out what the heck it is.

    Here's a (real) example:
    root@box> nmap -sT box
    911 open tcp unknown
    What the heck is running on port 911?

    root@box> ./lsof -i TCP|grep ":911 "
    SLSd_daem 1156 root 4u inet 0x02ca2900 0t0 TCP *:911 (LISTEN)

    Aha! SLSd_daem, PID 1156 is listen()ing on port 911.

    root@box> ps -AHo user,tty,ppid,pid,args|grep 1156
    root pts/0 3065 3100 grep 1156
    root ? 1 1156 /usr/bin/X11/SLSd_daemon
    root@box> I know where you live, SLSd_daemon.

    Check out the following URL for an authoritative list of port numbers


    29. How to add a jetadmin printer from command line

    This is simply done with the command:
    /usr/hpnp/bin/addqueue -i TYPE -q QUEUE_NAME -h HOST_ADDRESS
    The TYPE option comes from the list of printer types given by jetadmin but is not needed.
    To remove a printer you use the related: removequeue


    30. Converting /usr to vxfs

    1. Create a new partition
    2. "newfs -F vxfs" it
    3. Mount it (anywhere - say /mnt)
    4. Use your favourite backup/restore tool to copy /usr into it
    5. Modify /etc/fstab to mount this new usr onto /usr
    6. Reboot
    The rest of the process is a gimme - newfs the old /usr, mount & copy stuff back, put /etc/fstab how it was then reboot.

    General consensus on the HP-UX list is that this will work - and several people have done it.
    You can also use Ignite do achieve the same thing.


    31. Wiping a hard disk

    On HP-UX the best way to wipe a disk is to use: mediainit
    Check the man page for details.


    32. FTP: Access Denied

    This is a little FTP "gotcha". If you are getting the message: FTP: Access Denied, check your /etc/shells. If there is no entry ofr a user's shell in this file they will not be able to remote login.


    33. Finding the MAC address

    arp -a will tell you


    34. Getting rid of stale nfs file handles

    Run the command:
    #fuser -uck /<filesystem>


    35. FTP umask setting

    The ftp daemon (ftpd) uses an internal umask setting, the default being 027.
    This may be changed by editing the ftpd entry int the /etc/inetd.conf file. For example to change ftpd umask to, say, 022 in /etc/inetd.conf:
        ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l -u 22
    Restart inetd (inetd -c)


    36. Copying printers between servers

    To keep consistancy between servers/workstations here is a method to have all servers with the same printer config:

    1. On the source server/workstation where you have printer configured make sure that the print queue is empty.
    2. Shutdown the spooler
    3. tar/cpio "/etc/lp" and "/var/spool/lp" on the source server and startup the spooler.
    4. Restore the tar/cpio of /etc/lp and /var/spool/lp from source on to the destination workstations after shutting down the spooler.
    5. startup the spooler


    37. Entering username and passwd with CAPS LOCK

    This gettydef allows a user to log into a unix user account with caps lock on (password must also be entered with caps lock on), and receive the password prompt as normal: "Password:", not as "\PASSWORD:".
    The unix account name and password MUST be truely entered in lower case (in the /etc/passwd file) originally. The key was to eliminate OPOST output processing. This, combined with the user name and password in /etc/passwd in lowcase, and a mod to the .profile file handles it all beautifully!

         #login: # UCgoofy

    In order for the user to use the system as a non-caps-locked terminal, they will have to have the following entries in their profile:
    stty sane
    stty opost onlcr
    stty erase "^H" intr "^C"


    38. Is a system in trusted mode?

    How do you tell if a system is in trusted mode or not? Try looking at these two:
    man iscomsec
    /usr/lbin/getprdef -r


    39. Mounting a filesystem in a recovery shell

    You need to use loadfile and get /sbin/fs/hfs/* and /sbin/fs/vxfs/* to be able to mount filesystems in a recovery shell.


    40. Clearing the /var/opt/hparray logs

    I have had the situation with a Model 12 AutoRAID on a K-class running HP-UX 10.20. /var was getting a little to full for my liking and I have found that /var/opt/harray/log is taking up the most space. There are tools in /opt/bin/hparray, namely logprint and arraylog that are supposed to clear this. What I eneded up doing, however, was to delete all files in that directory and then touch LOGCATLG to recreate it. If you don't do the touch, ARMServer supposedly won't restart correctly. I did the delete and touch and had no problems.