Hpux Cheatsheet PDF
Hpux Cheatsheet PDF
HP UX Cheatsheet
Hardware Types:
9000 Series = PA-RISC based architecture
Integrity Series = Intel Itanium
Mounting CDROMs:
Get the device-file-name for the cd rom.
> ioscan -fnC disk
Use this device-file-name to mount the cd.
> mount device-file-name /mnt/local
Partitioning (Virtualization)
Creating Node Partitions (nPars) – hardware partitioning
1) Create Genesis Partition – go to MP -> CM -> CC and choose option G
2) Choose Cell that has IO board and core I/O card
3) Once created, type BO to boot the nPar and insert the HP DVD to start the
install
4) After installation, check with the: parstatus command
parstatus –w
parstatus –Vp0
Now you must create the nPar:
1) Check for an available cell board with: parstatus –AC
2) Find an available I/O chassis with: parstatus –AI
3) parcreate –P test_npar –c1::: ###Create the test_npar
4) Define the boot and alt boot disk with: parmodify –p1 –b 1/0/0/2/0.6.0 –t
1/0/0/3/0.6.0
5) parstatus –Vp1 and parstatus –P ###Check partition status
To add a cell to an nPar do: parmodify –p1 –a2::y: -B
shutdown –Ry now
parstatus –P
To remove an nPar: parremove –Fp1
shutdown –Ry now
Note: they can also be managed through SMH
Device Scanning
ioscan Show devices and probe for new ones OR:
insf -e Scans for new hardware (devfsadm) - use with ioscan
Disks
ioscan -fnk -C disk Show Disks (without the k allows detection of new disks)
also diskinfo -v path_to_disk Gives disk size info
Users
/etc/skel Kind of like the default user .profile and .login and such
export PS1='$PWD $'
useradd, usermod, and userdel work much like they do in Solaris/Linux
groupadd, groupmod, groupdel, newgrp work much like they do in Solaris/Linux
EX:
# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 1048576 163120 878576 16% /
/dev/vg00/lvol1 1835008 170688 1651416 9% /stand
/dev/vg00/lvol8 8912896 876648 7973504 10% /var
/dev/vg00/lvol7 5373952 2840728 2513512 53% /usr
/dev/vg00/lvol4 524288 21328 499040 4% /tmp
/dev/vg00/lvol6 8241152 4632080 3580912 56% /opt
/dev/vg00/lvol5 114688 5840 108000 5% /home
# lvextend -l 100 /dev/vg00/lvol6
Shell Scripting
strings filename Prints out any text possible from binary file
set –o vi Enables command line editing
stty erase [bsp] Set tty backspace character
awk ‘{print $1 “ “}’ filename Print 1rst field of file with a tab after
set and env Print variables (set = user and env = environment)
WBEM
swinstall –s /var/tmp/WBEMSvcs_A.02.07_HP-UX_B.11.31_IA_PA.depot Install
WBEM
swverify WBEMServices WBEMSvcs Verify Install
cimserver;/sbin/init.d/cim_server start (stop) Start /
Stop WBEM
osinfo Check
WBEM
Software Maintenance
/usr/sbin/swagentd –k OR /sbin/init.d/swagentd start|stop
Start/Stop swagentd
swagentd –r Restart
swagentd
swlist Show
installed software
swlist –l product Display installed software products
swlist –l subproduct Display installed subproduct
swlist –l fileset Display all installed filesets
swlist –I Run swlist in GUI/TUI
swinstall Install software
swinstall –s /var/depot Install software in location with all
defaults
swinstall –s hp02:/var/depot Install software residing on remote
machine
swinstall –s /var/depot IGNITE Install ignite software without
graphical/text interface
swverify –v IGNITE Verify installed software
swremove Start software removal process
swremove IGNITE Removes ignite software
Software Depots
swopy –s /dvdrom IGNITE @ /var/depot Copy Ignite software from DVD to local
depot
swcopy –s /dvdrom ‘*’ @ / var/depot Copy all software from DVD to local
depot
swreg –l depot /var/depot Register a depot (-ul unregisters)
swlist –l depot List depot
swlist –l product –d @ /var/depot List depot contents
swverify –d \* @ /var/depot Verify software in /var/depot
swremove –d IGNITE @ /var/depot Remove IGNITE from software depot
swremove –d \* @ /var/depot Remove a software depot
Patches
swlist –l patch –x show_superceded_patches=true Show patches that are overrided
show_patches Show patch listing
swlist –l fileset –a patch_state *,c=patch Show patch state
swlist –l fileset –a category_tag *,c=patch Show patch category
swlist –l fileset –a ancestor *,c=patch Show the ancestry of a patch
swlist –l patch Show all patches
Committing Patches
swmodify –x pathc_commit=true PHCO_36569 Commits the patch
cleanup –c 1 Commits superceded patches
and removes files
cleanup –d /depot/patch_depot Removes superceded patches
from a depot
Patch Assessment Tool – can be downloaded from http://itrc.hp.com via the swainv
script. Execute this on the system.
Checking against most current patches on internet -
/opt/sec_mgmt/spc/bin/security_patch_check –d –r
Or if you download and gunzip the security catalog from HP, run:
/opt/sec_mgmt/spc/bin/security_patch_check –d –c /tmp/security_catalog2
Software Assistant
Download and install with: swinstall –s /var/tmp/SwAssistant_C.01.04_HP-
UX_11iv2+v3_IA_PA.depot
swa report Works if you are connected to the Internet
If not connected to Internet:
Download the catalog file and: gunzip /tmp/swa_catalog.xml.gz
swa report –x catalog=/tmp/swa_catalog.xml
If it finds any identified patches run: swa get –t /var/depot
MIRRORING LVM
9000 (PA-RISC)
1. pvcreate –fB /dev/rdisk/disk5
2. vgextend vg00 /dev/disk/disk5
3. mkboot /dev/rdisk/disk5
4. mkboot –a “hpux –lq(;0)/stand/vmunix” /dev/rdisk/disk5
5. lvextend –m 1 /dev/vg00/lvol1 /dev/disk/disk5
6. lvextend –m 1 /dev/vg00/lvol2 /dev/disk/disk5 ….. all the way to lvol8
7. vgdisplay –v vg00
8. lvdisplay –v /dev/vg00/lvol1
9 lvlnboot –b /dev/vg00/lvol1
lvlnboot –r /dev/vg00/lvol3
lvlnboot –s /dev/vg00/lvol2
lvlnboot –d /dev/vg00/lvol2
lvlnboot –R
10. cat /stand/bootconf
11. lvdisplay /dev/vg00/lvol2
shutdown –ry now
12. ISL>hpux –lm
13. vgchange –a y –s vg00
14. lvchange –M n –c n /dev/vg00/lvol2
lvdisplay /dev/vg00/lvol2
15. reboot
16. setboot –a 0/0/4/0/0.0x0.0x0
lvlnboot –v
setboot
17. mkboot –a “hpux –lq(;0)/stand/vmunix” /dev/rdisk/disk2
lifcp /dev/rdisk/disk2:AUTO –
Integrity (Itanium)
1. vi /tmp/part_desc
3
EFI 500MB
HPUX 100%
HPSP 400MB
2. idisk –wf /tmp/part_desc/dev/rdisk/disk5
3. idisk /dev/rdisk/disk5
4. insf –e
ls –l /dev/rdisk | grep disk5
ls –l /dev/disk | grep disk5
5. pvcreate –fB /dev/rdisk/disk5
6. mkboot –e –l /dev/rdisk/disk5
7. efi_cp –d /dev/rdisk/disk2_p1 –u /efi/hpux/auto /tmp/auto_file
efi_cp –d /dev/rdisk/disk5_p1 /tmp/auto_file/efi/hpux/auto
8. vgextend vg00 /dev/disk/disk5_p2
Now run through steps 5-11 on the 9000 instructions above
10. HPUX> boot –lm vmunix
11. Follow steps 12 – 16 in 9000 instructions above
12. vi /tmp/auto_file
efi_cp –d /dev/disk/disk2_p1 /tmp/auto_file /efi/hpux/auto
efi_cp –d /dev/disk/disk5_p1 /tmp/auto_file /efi/hpux/auto
Mirroring Non-Boot VG
1. pvcreate –f /dev/rdisk/disk23
2. vgextend vg01 /dev/disk/disk23
3. lvextend –m 1 /dev/vg01/lvol1/dev/disk/disk23
lvextend –m 1 /dev/vg01/lvol2 /dev/disk/disk23
4. Use vgdisplay and lvdisplay to see results
Managing Mirrors
lvextend –L 4000 /dev/vgweb/lvol1 ####Extend mirrored LV to 4000 MB
lvreduce –L 1000 /dev/vgweb/lvol1 ####Reduce mirrored LV by 1000 MB
lvsplit /dev/vgweb/lvol1 ####Split mirror (detatch)
lvmerge /dev/vgweb/lvol1b /dev/vgweb/lvol1 ####Merge (attach) submirror
lvsync /dev/vgweb/lvol1 ####Sync a stale mirror
vgsync vgweb ####Sync all logical volumes in mirror
Filesystems
fstyp –l ####List supported filesystem types
newfs –F hfs /dev/vg01/rlvol1 ####Create HFS filesystem with
defaults
newfs –F vxfs /dev/vg01/rlvol2 ####Create JFS filesystem with defaults
newfs –F hfs –o largefiles –m 15 /dev/vg01/rvol1 ###Create filessytem with largefiles
and maintain 15% minimum free space
NOTE: there are specific versions of newfs in /sbin/fs/(hfs/vxfs)/ that can create new
filesystems
Mount a filesystem
mkdir /data1
mount –F hfs /dev/vg01/lvol1 /data1
mkdir /data2
mount –F vxfs /dev/vg01/lvol2 /data2
cat /etc/mnttab
Extending a filesystem
lvextend –L 1000 /dev/vg01/lvol1
umount /data1
extendfs –F hfs /dev/vg01/rlvol1
Also you can use this command instead of extendfs if this is vxfs:
fsadm –F vxfs –b 2560000 /data2 ####The –b is 2056 X 1024
Replace/repair superblock
Look for an alternate superblock in /var/adm/sdtab then:
fsck –F hfs –b 16 /dev/vg01/rlvol1
Mount DVD/CD
ioscan –fNnkCdisk | DVD
mkdir /dvdrom
mount –F cdfs –o ro /dev/disk/disk3 /dvdrom
OR to keep filename case:
mount –F cdfs –o cdcase –o ro /dev/disk/disk3 /dvdrom
to unmount:
umount /dvdrom
Swap
swapinfo View swap areas
swapinfo –atm Gives totals with swap info
FROM OS SHELL:
setboot Shows same at the shell
setboot –b on/off enables / disables autoboot
setboot –s on/off enables / disables autosearch
BCH commands
sea searches for devices to boot from
HPUX> showauto
To modify:
HPUX>setauto –d Delete auto file
HPUX>setauto “boot vmunix –lq” Modifies auto file
Security
In /etc/default/security, edit the lines:
BOOT_AUTH=1 and BOOT_USERS=root to allow others to access single suer
Hardware Scanning:
Run ioscan and insf
Kernel Management
kcweb Kernel configuration tool
Other tools include kconfig, kcmodule, kctune
find . | cpio –ocv > /dev/rtape/tape2_BEST Archive current directory and copy to
tape
find . –mtime 7 | cpio –ocv >/tmp/mod.cpio Archive only those that changed in
last week
cpio –ivc < /tmp/mod.cpio Restore from archive
Printing
lpsched OR /sbin/init.d/lp start Start printer queue scheduler
lpshut OR /sbin/init.d/lp stop Stop scheduler
Remove a printer:
reject prn1
disable prn1
lpadmin –xprn1
Healthchecking/Performance Monitoring
uptime
sar
top
glance (or gpm)
swapinfo
vmstat
iostat
ps
ipcs
time or timex
nwmgr/netstat/lanadmin
Networking
nwmgr or lanscan Report interfaces on the system
nwmgr –v –c lan4 Display interface characteristics
ndd –h supported Displays available TCP tunable parameters
/sbin/init.d/nettle start/stop Turn on/off TCP tracing
ioscan –fnkC lan Displays network cards on system
linkloop 0x00306E469D5C Check link between you and MAC address shown
lanadmin Menu driven interface tool
lanadmin –a 1 Show MAC of interface at PPA 1
lanadmin –s 1 Displays NIC speed
lanadmin –x 1 Displays NIC duplex
lanadmin –X 100fd 1 Sets speed/duplex
ifconfig lanx Report ifconfig on interface shown in lanscan
ifconfig lan1:1 192.168.1.2 Add an alias interface to lan1
To configure interfaces to start at boot: vi /etc/rc.config.d/netconf then run:
/sbin/init.d/net start
DHCP
vi /etc/rc.config.d/netconf
DHCP_ENABLE[4]=1
Then:
/sbin/init.d/net start
SERVICES
cat /etc/inetd.conf Can turn off and on telnet and ftp by
commenting out
It can be controlled by entering in stanzas in /var/adm/inetd.sec at user and system
level:
Ex. telnet allow 192.11.211.*
inetd –l Enabled inetd connection logs – can be made
permanent with: vi /etc/rc.config.d/netdaemons and set INETD_ARGS to 1
inetd –c Reload configuration
cat /etc/services Maps service names to port and protocol
cat /etc/rpc Shows RPC services and ports
SENDMAIL
To configure:
1. Add user accounts
2. vi /etc/rc.config.d/nfsconf and set NFS_SERVER to 1
3. Add this to /etc/dfs/dfstab:
/var/mail
4. vi /etc/rc.config.d/mailservs and set SENDMAIL_SERVER to 1
5. vi /etc/mail/sendmail.cw and add all client hostnames to bottom of file
6. vi /etc/mail.sendmail.cf and add:
Fw/etc/mail/sendmail.cw
7. /sbin/init.d/nfs.server start
/sbin/init.d/sendmail start
Then on clients:
1. vi /etc/rc.config.d/mailservs and set:
SENDMAIL_SERVER=0
SENDMAIL_SERVER_NAME=hp02
2. vi /etc/rc.config.d/nfsconf and set NFS_CLIENT to 1
3. vi /etc/fstab:
hp02:/var/mail /var/mail nfs defaults 0 0
4. /sbin/init.d/sendmail start
/sbin/init.d/nfs.client start
Check sendmail:
bdf –i | mailx –s “Filesystem list of Systems” ccoppock@us.ibm.com
mailq –v ####show mail queues
Aliases
To add a new alias to a user account database, vi /etc/mail/aliases.
Then run newaliases
NTP
Configure Server (can be done from smh too):
1. Select a time source (i.e. the example below local system at reserved address
127.127.1.1 with stratum keyword fudge)
2. vi /etc/ntp.conf
server 127.127.1.1
fudge 127.127.1.1 stratum 9
If you use an internet time system: server 11.59.99.3
For a peer: peer hp03
3. vi /etc/rc.config.d/netdaemons
NTPDATE_SERVER=11.59.99.3
XNTPD=1
4. /sbin/init.d/xntpd start
Client:
1. vi /etc/ntp.conf
server hp01
driftfile /etc/ntp/drift
2. vi /etc/rc.config.d/netdaemons
NTPDATE_SERVER=hp01
XNTPD=1
3. /sbin/init.d/xntpd start
NFS
To configure an NFS server:
1. vi /etc/dfs/dfstab
share –F nfs –o ro /usr/share/man
share –F nfs –o anon=104 –d “Sendmail Binaries” /opt/samba
2. vi /etc/rc.config.d/nfsconf
NFS_CORE=1
NFS_SERVER=1
START_MOUNTD=1
3. /sbin/init.d/nfs.server start
shareall
To configure NFS client:
1. showmount –e OR share
2. vi /etc/rc.config.d/nfsconf
NFS_CLIENT=1
3. /sbin/init.d/nfs.client start
4. vi /etc/fstab and add:
hp02:/usr/share/man /usr/share/man nfs ro
0 0
hp02:/opt/samba /opt/samba nfs defaults
0 0
5. create the mount points if they don’t exist with mkdir
6. mountall OR mount –aF nfs
AUTOFS
To configure:
1. vi /etc/rc.config.d/nfsconf
NFS_CLIENT=1
AUTOFS=1
AUTOMOUNT_OPTIONS=””
AUTOMOUNTD_OPTIONS=””
AUTOMOUNT_TIMEOUT=600
2. /sbin/init.d/autofs.start
OR:
automountd
automount –v
Maps:
cat /etc/auto_master Show default master file with entries below:
/net –hosts –nosuid,soft,nobrowse
SAMBA/CIFS
Note: in inet.conf, uncomment the swat line to allow access to SWAT vi:
http://server:901
Configuration:
1. swlist –l product | grep CIFS
2. vi /etc/rc.config.d/samba
RUN_SAMBA=1
3. vi /etc/opt/samba/smb.conf
4. Make the following entries in smb.conf:
[global]
netbios name =hp02
workgroup =localwg
server string =CIFS server
hosts allow =192.168.1
security =user
[mail]
comment =Mail directory
path =/var/mail
writeable =yes
browseable =no
5. /opt/samba/bin/testparm
6. touch /var/opt/samba/private/smbpasswd
chmod 600 /var/opt/samba/private/smbpasswd
chmod 500 /var/opt/samba/private
/opt/samba/bin/smbpasswd –a username
7. /sbin/init.d/samba start
/opt/samba/bin/startsmb
8. /opt/samba/bin/smbstatus
NIS
Configure Master Server
1) Make sure all passwd entries on all systems are part of /etc/passwd or
/etc/shadow and make sure there are no duplicates
2) domainname coppock ###Define unique domain name
3) vi /etc/rc.config.d/namesvrs
NIS_DOMAIN=coppock
NIS_MASTER_SERVER=1
NIS_CLIENT=1
4) ypinit –m
When on the slave servers end the entry with Cntrl+d
5) /sbin/init.d/nis.server start
/sbin/init.d/nis.client start
Secure NIS
1) Create /var/yp/securenets
2) Specify IP and mask of system or network not allowed access
3) /sbin/init.d/nis.server stop
/sbin/init.d/nis.server start
DNS
what /usr/sbin/named Check BIND Version
Configuration is beyond the scope of a cheatsheet and can be found on page 579 of the
book
Ignite UX
GUI Configuration
1) edit /etc/inetd.conf and uncomment tftp
2) inetd –c
3) vi /etc/passwd
tftp:*:510:1:Trivial FTP user:/home/tftpdir:/usr/bin/false
4) /opt/ignite/bin/ignite
5) Click Server setup
6) Enter Ip and MAC addresses – if this is an Integrity client vi /etc/bootptab and
insert the stanza on page 609
7) Skip DHCP
8) Select Copy CD
9) Exit
Cloning to Network
1) mkdir –p /var/opt/ignite/recovery/archives/hp05
chown bin:bin /var/opt/ignite/recovery/archives/hp05
vi /etc/dfstab
/var/opt/ignite/recovery/archives/hp05 anon=2,access=hp01
shareall
2) make_net_recovery –v –s hp01 –a
hp01:/var/opt/ignite/recovery/archives/hp05
Security
passwd –f –n 7 –x 28 ccoppock Sets password expiration
passwd –s ccoppock Checks for Password and expiration
properties
pwconv Implements shadow password
/etc/tsconvert Implements “trusted mode” security
(-r reverts back)
/usr/lbin/modprpw –lk username Unlocks a trusted account user
PAM
/etc/pam.conf Controls system-wide auth
/etc/pam_user.conf Controls user-wide auth
cat /etc/pam.conf
Has entries such as:
login auth required /usr/lib/security/libpam.unix.1