Ed Skinner wrote: > I have submitted MiscHowTo.txt.gz for consideration for the PLUG download > area. While pending approval for inclusion there, it is available now at: > http://www.flat5.net/MiscHowTo.txt.gz > > Best regards to everyone... > > > > On Friday 11 June 2004 07:43, Ed Skinner wrote: > >> I have something for the PLUG Website that should be of interest to >>newbies and possbly even old-farts such as myself. For some years I've >>slowly accumulated a list of notes on doing various things in Linux. I >>think of it as my personal "big dummy" list -- it's how to do various >>things that I don't do often enough to memorize. Some of the things go in >>categories (setting up CUPS, printers and printing files in various ways) >>and some things end up in a "one-liners list" of simple, one-line commands >>for various purposes. Some are entries gleaned from this mailing list, by >>the way. (Thank you!) I'm looking for a "good place" on the PLUG website >>but the content crosses the boundary between FAQ (or more likely, "Not So >>FAQ But Wish I Had") and something in the Downloads which, unfortunately, >>ends up somewhat buried and hidden. >> Where do you think it should go? > > Installment #2 from my brain (AKA PDA) - Unix I separated each entry with ==='s. In my PDA, these are all individual entries in the "Unix" category. AIX: Elements of Security Effective and Efficient Implementation http://www.redbooks.ibm.com/redbooks/SG245962.html ======================================================================================= AIX: mirror bootdisks # mirrorvg -m -S rootvg hdisk0 # bosboot -ad /dev/hdisk0 # bootlist -m normal -o hdisk0 hdisk1 ======================================================================================= AIX: Mount CD-ROM mount -v'cdrfs' -p'' -r" /dev/cd0 /mn' ======================================================================================= AIX: NFS Client on Linux Server Need to change Linux NFS server /etc/exports to include "insecure" as one of the mount options: ======================================================================================= AIX: Resizing Filesystem chfs -a size=+81920 /usr ======================================================================================= AIX: Updating System Using browser on system: http://www-912.ibm.com/eserver/support/fixes/fcgui.jsp Click on "Fix release information" Download the latest fix data file Run "compare_report" using the above data file as input. Upload the file generated by the AIX "compare_report" command and submit the form. TBD ======================================================================================= AIX: Web System Management http://domain.com/wsm.html ======================================================================================= CD: Burning CDR 1. Find your CDR or CDRW drive # cdrecord -scanbus 2. Burn ISO Image to CDR or CDRW # cdrecord -v speed=2 dev=0,0,0 whatever.iso *** Keep the speed down for more reliable burns ======================================================================================= Credentials: Password File Format Example: smithj:x:561:561:Joe Smith:/home/smithj:/bin/bash Each field in a passwd entry is separated with ":" colon characters, and are as follows: - Username, up to 8 characters. Case-sensitive, usually all lowercase - An "x" in the password field. Passwords are stored in the ``/etc/shadow'' file. - Numeric user id. This is assigned by the ``adduser'' script. Unix uses this field, plus the following group field, to identify which files belong to the user. - Numeric group id. Red Hat uses group id's in a fairly unique manner for enhanced file security. Usually the group id will match the user id. - Full name of user. I'm not sure what the maximum length for this field is, but try to keep it reasonable (under 30 characters). - User's home directory. Usually /home/username (eg. /home/smithj). All user's personal files, web pages, mail forwarding, etc. will be stored here. - User's "shell account". Often set to ``/bin/bash'' to provide access to the bash shell (my personal favorite shell). ======================================================================================= Credentials: Shadow File Format Example: smithj:Ep6mckrOLChF.:10063:0:99999:7::: As with the passwd file, each field in the shadow file is also separated with ":" colon characters, and are as follows: - Username, up to 8 characters. Case-sensitive, usually all lowercase. A direct match to the username in the /etc/passwd file. - Password, 13 character encrypted. A blank entry (eg. ::) indicates a password is not required to log in (usually a bad idea), and a ``*'' entry (eg. :*:) indicates the account has been disabled. - The number of days (since January 1, 1970) since the password was last changed. - The number of days before password may be changed (0 indicates it may be changed at any time) - The number of days after which password must be changed (99999 indicates user can keep his or her password unchanged for many, many years) - The number of days to warn user of an expiring password (7 for a full week) - The number of days after password expires that account is disabled - The number of days since January 1, 1970 that an account has been disabled - A reserved field for possible future use ======================================================================================= Find SGID files (with ls option) find / -type f -perm -02000 -ls ======================================================================================= Find SUID files (with ls option) find / -type f -perm -04000 -ls ======================================================================================= Find World-writable files (with ls option) find / -perm -2 -type f -print ======================================================================================= Linux: Automount NFS Filesystem /etc/auto.misc: share -fstype=nfs,ro,soft,intr,rsize=8192,wsize=8192 sysadmin:/share /etc/auto.master: /misc /etc/auto.misc --timeout=60 ln -s /misc/share /share /etc/init.d/autofs restart ======================================================================================= Linux: Binding 2nd IP Address to NIC RED HAT SPECIFIC!!! cd /etc/sysconfig/network-scripts cp ifcfg-eth0 ifcfg-eth0:0 vi ifcfg-eth0:0 (Change contents as shown below) DEVICE=eth0:0 BOOTPROTO=static IPADDR= NETMASK=255.255.255.0 ONBOOT=yes :wq ifup eth0:0 (error may occur - this is OK) /etc/init.d/network restart ifconfig (verify new IP address is present) log into the box from somewhere else using new IP ======================================================================================= Linux: Change MAC Address ifconfig eth0 hw ether ifdown eth0 ifup eth0 ======================================================================================= Linux: Installing Oracle http://www.puschitz.com/InstallingOracle9i.shtml ======================================================================================= Linux: Knoppix: Hard Disk Install Ref: http://www.freenet.org.nz/misc/knoppix-install.html Installation Procedure To get Knoppix installed onto your hard drive: Boot the Knoppix CD. When the boot prompt comes up, choose your language. Most of us speak English, so we'll type: knoppix lang=en at the boot: prompt, then press ENTER. Wait till the system is fully launched, including the KDE desktop Press CTRL-ALT-F2, to get a root console. You should see a shell prompt Type: knx-hdinstall Follow the guided installation menus. This will include: - Creating a Linux partition (at least 2.5GB - Creating a Linux Swap partition (at least 256MB) - 'Mounting' the Linux partition as root - Initializing the swap partition - Copying all the required files (automatically) - Setting up networking - Setting passwords - Setting up the bootloader - Rebooting (without the CD) When you've rebooted Knoppix from your hard disk, click on the KDE Control Center icon in the launcher at the bottom of the screen (icon of a color monitor with a card in front of it) Within the Control Center, click on Personliche Einstellungen Click on Land und Sprache Choose the locale and language of your choice Click on Andwenden at bottom of that window Close and restart the Control Center Click on Peripherals, then Keyboard, and choose your preferred keyboard layout (which will probably be US.English. Click OK and close the window Press CTRL-ALT-F2 to get to the root console, and log in as root (using the password you chose when you ran the installer) (Optional) - type "apt-get update". This will update your list of available packages, and takes about 5-10 minutes. ======================================================================================= Linux: Overview of apt commands apt-get update Download package lists. Packages change several times daily, so do this often. apt-get dist-upgrade Update all packages. apt-get install Install/upgrade specific package(s) (and its dependencies, if missing any). apt-get mirror-select Choose repositories and mirrors for use with apt (fedora.us specific extension). apt-cache search Search all known packages entries (descriptions etc) for word. apt-cache show Show basic information about a package. Ref: http://www.fedora.us/wiki/FedoraHOWTO ======================================================================================= Linux: Performance Analysis The Open Road: Linux System Performance Tools by Joe "Zonker" Brockmeier http://click.unixreview.email-publisher.com/maacgOraa61kja5cUodb/ ======================================================================================= Linux: RAID Add Disk mdadm /dev/mdx -a /dev/hdxn ======================================================================================= Linux: RAID Build Set - 1 disk mdadm -C /dev/mdx -l -n 2 /dev/hdxn missing -l = RAID Level -n = Number of devices ======================================================================================= Linux: RAID Build Set - 2 disks mdadm -C /dev/mdx -l -n 2 /dev/hdxn /dev/hdyn -l = RAID Level -n = Number of devices ======================================================================================= Linux: RAID Remove Disk mdadm /dev/mdx -r /dev/hdxn ======================================================================================= Linux: RAID Status # cat /proc/mdstat The output of /proc/mdstat is as follows : Personalities : [raid1] read_ahead 1024 sectors md0 : active raid1 sdb1[1] sda1[0] [2/2] [UU] * The [UU] part above specifies that both the partitions on the Raid Devices are up. * If you get [_U] in place of [UU] then the First HDD is down and raid is booting linux through the second HDD. Fix your first HDD problem and the recreate RAID. * [U_] indicate the Second HDD is down. Ref: http://puggy.symonds.net/~rajesh/raid.html ======================================================================================= Linux: Removing Shared Memory Semaphores Example assuming the HTTP process is goobered, # ipcs -qa Look for entries owned by http and note the semid. For each entry owned by http: # ipcrm sem ======================================================================================= Linux: RPM: what files in rpm rpm -qpl file.rpm ======================================================================================= Linux: Tuning Network Connections http://www.psc.edu/networking/perf_tune.html#Linux, http://cvsview.tldp.org/index.cgi/LDP/guide/docbook/Tuning-Linux/network.sgml, http://www.networkcomputing.com/1122/1122ws2.html Google for tuning linux network ======================================================================================= Linux: Turn IP Forwarding off sysctl -w net.ipv4.ip_forward=0 ======================================================================================= Linux: What process is using a port? lsof -i -n -P lsof -Pin ======================================================================================= Solaris: /etc/vfstab & fsck order The seven fields of vfstab are: 1. Block device - used for 'mount', and 'swap' 2. Character (raw) device - used for fsck. (for swap partitions ths should be "-") 3. Mount point for the file system (for swap partitions ths should be "-") 4. Filesystem type. 'ufs' for a filesystem, 'swap' for a swap partition. 5. fsck pass number. See below 6. mount at boot time ? YES|NO 7. mount options. see mount(8) Fsck pass number The fsck pass number seems to be the source of some confusion Solaris (along with most other Unix variants) is capable of checking multiple filesystems simultaneously - well it is a multi-processing system. fsck will perform as many passes as there are different pass numbers in /etc/vfstab. Filesystems on pass 1 will be checked on the 1st pass, those on pass 2 will be checked on the 2nd pass, etc. Your objectives when setting pass numbers are: 1. Have as few passes as possible 2. Never have more than one filesystem on a single physical disk checked on the same pass. - this will thrash that disk and slow down the process enormously Ideally have similarly sized filesystems checked on the same pass. (performance) - this is a nicety, points 1 & 2 are far more important. Adherence to these points will enable your system to complete a full filesystem check in the minimum possible time. The root filesystem will be checked on its own pass regardless of any pass number you put it in. Setting the pass number to zero will result in fsck never being run on the filesystem at boot time. Unless the filesystem is not mounted at boot time this highly unwise - corrupt filesystems crash systems. Still Confused? Then just find the highest current pass number and add one. Your new disk will get checked out after all the other filesystems. ======================================================================================= Solaris: Changing hostname Ref: http://sysunconfig.net/unixtips/solaris_change_hostname_script.txt #!/usr/bin/bash # By Sandra Henry-Stocker # ---- prompt for new hostname, current hostname is default ---- oldName=`uname -n` newName=`ckstr -p "Enter new Hostname [$oldName]" -d $oldName` # ---- confirm change ---- ok=`ckyorn -p "Change hostname to $newName?"` case $ok in [Yy]*) echo OK ;; [Nn]*) echo exiting without changes ;; esac # ---- check if /etc/hosts --> /etc/inet/hosts ---- if [ ! -s /etc/hosts ]; then echo WARNING: /etc/hosts is NOT a symbolic link to /etc/inet/hosts ans=`ckyorn -p "Change both?"` case $ok in [Yy]*) perl -i -p -e "s/$oldName/$newName/g" /etc/hosts ;; [Nn]*) echo exiting without changes ;; esac fi # ---- make changes to /etc files ---- perl -i -p -e "s/$oldName/$newName/" /etc/nodename perl -i -p -e "s/$oldName/$newName/" /etc/hostname.* perl -i -p -e "s/$oldName/$newName/g" /etc/inet/hosts # ---- make changes to /etc/net files ---- for hostsFile in `find /etc/net -name hosts -print` do perl -i -p -e "s/$oldName/$newName/g" $hostsFile done # ---- move or create /var/crash directory ---- if [ -d /var/crash/$oldName ]; then mv /var/crash/$oldName /var/crash/$newName else mkdir /var/crash/$newName chmod 700 /var/crash/$newName fi dumpadm -s /var/crash/$newName # ---- finally, change hostname ---- uname -S $newName # ---- confirm changes ---- uname -a ======================================================================================= Solaris: Copy Filesystem Ensure destination filesystem is created *see newfs) and mounted. ufsdump 0f - /dev/rdisk/c0t0d0s7 | (cd /newfilesystem;ufsrestore xf -) Ref: ufsrestore man page ======================================================================================= Solaris: Copy Filesystem tar cvBnf - | ( cd /whatever && tar xBnf - ) ======================================================================================= Solaris: Diagnostics: Network Hardware GOOD CHECK: {0} ok watch-net-all /pci@1f,0/pci@1,1/network@1,1 Hme register test --- succeeded. Internal loopback test -- succeeded. Transceiver check -- Using Onboard Transceiver - Link Up. passed Using Onboard Transceiver - Link Up. Looking for Ethernet Packets. '.' is a Good Packet. 'X' is a Bad Packet. Type any key to stop. ........ ................................................................ ................................................................ ................................................................ .................................... ok BAD CHECK: {0} ok watch-net-all /pci@1f,0/pci@1,1/network@1,1 Internal loopback test -- succeeded. Transceiver check -- failed {0} ok ======================================================================================= Solaris: Hardware Info /usr/platform/sun4u/sbin/prtdiag ======================================================================================= Solaris: HELP http://sysunconfig.net/unixtips/solaris.html ======================================================================================= Solaris: Making /etc/system Changes and Recovering From Them Installation: Make sure to make a backup file!! # cp -fp /etc/system /etc/system.mevmev Fallback: If the system even "kinda" booted, then shutdown to the ok prompt. # init 0 Now boot the system into single user mode with prompts ("ask") ok boot -as Accept the defaults until you get to the following prompt: Name of system file [etc/system]: Enter the following Name of system file [etc/system]: etc/system.mevmev Continue accepting defaults through the remainder of the boot. You should now be at the following prompt: Type control-d to proceed with normal startup, (or give root password for system maintenance): Login to single user mode by inputting the root password here Type control-d to proceed with normal startup, (or give root password for system maintenance): You will now arrive at a root shell prompt. Restore the /etc/system file # cp -p /etc/system.mevmev /etc/system Reboot # init 6 System should now boot to multiuser mode with the correct /etc/system file. ======================================================================================= Solaris: Mount CDROM # /etc/init.d/volmgt stop # mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /cdrom/cdrom0 ======================================================================================= Solaris: Networking: Bind a virtual IP address to Network Interface Card # ifconfig qfe0:1 plumb --- in some cases this is not needed if qfe0 has been plumb # ifconfig qfe0:1 202.40.231.4 netmask 255.255.255.0 broadcast + up Create a file on /etc directory – hostname.qfe0:1 with hostname entry Add entry on /etc/netmasks if IP address is on different subnet Add entry on /etc/inet/hosts file with IP address and hostname Ref: http://www.tek-tips.com/gfaqs.cfm/lev2/3/lev3/20/pid/60/fid/3981 ======================================================================================= Solaris: Networking: Change the default route Step 1: edit /etc/defaultrouter Edit the file /etc/defaultrouter -- the only line in the file should be the default route of the system, for example: 192.168.1.1. This change will not take effect until the system is rebooted. Step 2: Delete the current default route To make the route change take effect immediately, you must first delete the default route. If the current default route is 192.168.254.1, then the command would be: route delete default 192.168.254.1 Step 3: Assign the current default route To implement the new default route without rebooting the system, use the following command substituting your default route for 192.168.1.1: route add default 192.168.1.1 Ref: http://www.tech-recipes.com/solaris_networking_tips1.html ======================================================================================= Solaris: Networking: Configuration (add/change) /etc/defaultdomain NIS/NIS+ domain name. /etc/defaultrouter IP address of the default router. /etc/resolv.conf Internet domain name, name server and search order. An example of resolv.conf domain la.asu.edu nameserver 129.219.17.200 nameserver 129.219.17.5 search la.asu.edu asu.edu /etc/nsswitch.conf specifying information source from files, NIS, NIS+, or DNS. /etc/hostname.{hme0|le0} Ipv4 hostname. /etc/nodename IPv6 hostname. /etc/inet/hosts Host name file (/etc/hosts is a link to this file). /etc/inet/netmasks TCP/IP subnet masks. /etc/inet/protocols Network protocols. /etc/inet/services Network service name and port number. /etc/inet/inetd.conf Internet super daemon configuration file. Change hostname/IP address - /etc/hostname.{hme0|le0} - /etc/nodename - /etc/inet/hosts - /etc/net/*/hosts - /etc/defautrouter - /etc/resolv.conf - /etc/defaultdomain ref: http://www.variate.net/deviate/tech/solaris/Solaris_quickref.pdf ======================================================================================= Solaris: Networking: How do I create a DHCP client? Create two empty file /etc/hostname.xxx and /etc/dhcp.xxx for each interface, where xxx is interface name, like le0, hme0. For more than one interfaces you can create both files for each interface. In this example I am creating le0 and le0:1 (virtual interface). Create two empty interfaces on the client: # touch /etc/hostname.le0 # touch /etc/dhcp.le0 or create virtual interface on the client: # touch /etc/hostname.le0:1 # touch /etc/dhcp.le0:1 Verify you created the files: #ls -l /etc/*.le* -rw-r--r-- 1 root root 9 Mar 18 1997 /etc/hostname.le0 -rw-r--r-- 1 root other 11 Oct 23 11:33 /etc/hostname.le0:1 -rw-r--r-- 1 root root 0 Oct 24 09:11 /etc/dhcp.le0 -rw-r--r-- 1 root other 0 Oct 27 09:11 /etc/dhcp.le0:1 After creating these files you can setup, reboot or use ifconfig command to configure the interface. Run ifconfig to configure the insterface: # ifconfig le0 dhcp start # Normal interface or # ifconfig le0:1 dhcp start # Virtual Interface Test the interface status: # ifconfig -a le0:1: flags=4843 mtu 1500 inet 192.240.240.1 netmask ffffff00 broadcast 192.240.240.255 Here are some useful dhcp commands that will help you get through the dhcp process: To release dhcp type the following: # ifconfig le0 dhcp release To start the dhcp interface back up again: # ifconfig le0 dhcp start To get status on any dhcp interface: # ifconfig le0 dhcp status Interface Status Sent Received Rejects pcelx0:1 BOUND 2 2 0 (Began,Expires,Renew) = (04/11/1999 18:35, 04/14/1999 18:35, 04/13/1999 06:35) Ref: http://www.geocities.com/~gregl/htm/fasttips_interface.htm ======================================================================================= Solaris: Networking: NDD: Interface Status This allows you to see if the interface has a link: # ndd -set /dev/qfe instance Note: the above is the qfe port of interest. Example - to get status of qfe1: # ndd -set /dev/qfe instance 1 # ndd -get /dev/qfe link_status 0 = down 1 = up # ndd -get /dev/qfe link_speed 0 = 10mbps 1 = 100mbps # ndd -get /dev/qfe link_mode 0 = half 1 = full ======================================================================================= Solaris: Networking: NDD: Interface Status Script Ref: http://sysunconfig.net/unixtips/nic_check.txt #!/bin/ksh #set -xv # # nic_check - 01/12/2001 - David Cashion - initial script # - 11/06/2002 - David Cashion - added ability to look at all # interfaces or just the one specified # # Polls the interfaces specified (or all of them with exception of leX and # loX) for speed, link, duplex, and transceiver location. # # NOTE: Needs to be run as root. #### Pick the interface given or run through all of them (except l[eo]) if [ $# -eq 1 ]; then if [ $1 == "-all" ]; then nics=$(/usr/sbin/ifconfig -a | awk -F: '/^[a-km-z]/ {print $1}' | sort -u) print "Checking these network interfaces: $nics\n" else nics=$1 fi else print "USAGE:" print "\t$0 INTERFACEinstance" print "\t$0 -all" print "\n\tExample: $0 hme0" exit 1 fi for item in $nics; do interface=$(echo $item | cut -c1-3) int_inst=$(echo $item | cut -c4) #### First we have to select the interface and instance $(/usr/sbin/ndd -set /dev/$interface instance $int_inst) if [ $? -ne 0 ]; then print "ERROR: No such device: $item" exit 1 fi print "Network interface: $item" echo "-----------------------" #### 0=down, 1=up print -n "Link: " [ $(/usr/sbin/ndd -get /dev/$interface link_status) -eq 0 ] && print "down" || print "up" #### 0=10Mb, 1=100Mb print -n "Speed: " [ $(/usr/sbin/ndd -get /dev/$interface link_speed) -eq 0 ] && print "10Mb" || print "100Mb" #### 0=half, 1=full duplex print -n "Duplex: " [ $(/usr/sbin/ndd -get /dev/$interface link_mode) -eq 0 ] && print "half" || print "full" print done ======================================================================================= Solaris: Networking: Plumbing # ifconfig qfe1 plumb # ifconfig qfe1 netmask broadcast + # ifconfig qfe1 up Ref: http://www.techgirl-net.com/nic.html Unplumb (to make changes or remove interface): # ifconfig qfe1 unplumb # ifconfig -a ======================================================================================= Solaris: Networking: Snoop Capture everything: snoop -v -d eri0 Look for just stuff on a certain IP: snoop -v -d eri0 1.2.3.4 Reduced verbosity: -V Summary only: -s ======================================================================================= Solaris: Networking: Verifying a route to a specified network # route -n get xxx.yyy.zzz.0 route to: xxx.yyy.zzz.0 destination: default mask: default gateway: xxx.yyy.aaa.254 interface: hme0 flags: recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire 0 0 0 0 0 0 1500 0 # ======================================================================================= Solaris: NFS: File Sharing /etc/vfstab File mount table (local or NFS). *** REQUIRED FOR CLIENT *** /etc/dfs/dfstab File sharing table (NFS server). *** REQUIRED FOR SERVER *** /etc/auto_master Automounter master map, sample as follow #### Master map for automounter #### /home auto_home -nobrowse /- auto_direct -ro /etc/auto_home Automount home (indirect) map, sample as follow #### mount home directory ##### jialong bluebear:/export/home/jialong /etc/auto_direct Automount direct map, sample as follow #### mount /usr/local from a server #### /usr/local bluebear:/usr/local /etc/vold.conf Volume manager configuration. share [options] pathname export NFS file systems to other computers. mount [options] filesrv:/pathname /mnt Mount remote file system. For security, when possible, mount system as readonly and nosuid. /etc/rmmount.conf Removable disk configuration. ref: http://www.variate.net/deviate/tech/solaris/Solaris_quickref.pdf ======================================================================================= Solaris: OBP Booting {0} ok boot -sv Boot device: vx-disk01 File and args: -sv Can't open boot device {0} ok to fix: {0} ok setenv boot-device disk boot-device = disk {0} ok boot -sv Boot device: /pci@f,4000/scsi@3/disk@0,0 File and args: -sv : : : ======================================================================================= Solaris: OS Patching Patch Pro Download from: http://wwws.sun.com/software/download/products/3f9d714b.html gunzip and untar, then run setup in the ppro dir Fix your path: # vi /.profile PATH=/opt/SUNWppro/bin:/usr/sadm/bin:$PATH export PATH MANPATH=/opt/SUNWppro/man:${MANPATH} export MANPATH Once installed, edit config file: /opt/SUNWppro/etc/patchpro.conf and ensure the following 2 lines have the proxy settings: patchpro.proxyserver.host= patchpro.proxyserver.port= Then run patch pro: # pprosvc -i -n -c recommended To apply a specific patch: # pprosvc -i -p 114045-10 ======================================================================================= Solaris: Package Management Find out what package a given file belongs to: grep /path/to/file /var/sadm/install/contents ======================================================================================= Solaris: Quick Reference: CDE Desktop cd /usr/dt/bin ./Xsession & ======================================================================================= Solaris: Quick Reference: Crashed System Get to OK prompt sync (this syncs filesystems and reboots) ======================================================================================= Solaris: Quick Reference: Find out a package which a file belongs to % pkgchk -l -p /usr/lib/sendmail Pathname: /usr/lib/sendmail Type: regular file Expected mode: 4555 Expected owner: root Expected group: bin Expected file size (bytes): 650720 Expected sum(1) of contents: 22626 Expected last modification: Apr 07 04:13:53 1999 Referenced by the following packages: SUNWsndmu Current status: installed ======================================================================================= Solaris: Quick Reference: Grow a UFS Filesystem (use format first to increase partition size) ### DO THIS FROM THE RESUE DISK ### After changing partition size, print the partition map and note the size in blocks of the partition. This number is the newsize # /usr/lib/fs/ufs/mkfs -G -M /current/mount /dev/rdsk/cXtYdZsA newsize Example: partition> pr Current partition table (unnamed): Total disk cylinders available: 38307 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 258 - 15678 30.00GB (15421/0/0) 62917680 # /usr/lib/fs/ufs/mkfs -G -M / /dev/rdsk/c0t0d0s0 62917680 ref: http://www.science.uva.nl/pub/solaris/solaris2/Q3.72.html ======================================================================================= Solaris: Quick Reference: HD Info(vendor, RPM, capacity) oasis:/home/tse/dxy[9:18pm] iostat -E sd0 Soft Errors: 0 Hard Errors: 3 Transport Errors: 0 Vendor: SEAGATE Product: ST34371W SUN4.2G Revision: 7462 Serial No: 9742K71685 RPM: 7200 Heads: 16 Size: 4.29GB Media Error: 0 Device Not Ready: 0 No Device: 3 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 sd1 Soft Errors: 0 Hard Errors: 3 Transport Errors: 0 Vendor: SEAGATE Product: ST32171W SUN2.1G Revision: 7462 Serial No: 9736T74649 RPM: 5400 Heads: 19 Size: 2.13GB Media Error: 0 Device Not Ready: 0 No Device: 3 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 sd6 Soft Errors: 0 Hard Errors: 3 Transport Errors: 0 Vendor: TOSHIBA Product: XM5701TASUN12XCD Revision: 0997 Serial No: 04/09/97 RPM: 0 Heads: 0 Size: 18446744073.71GB Media Error: 0 Device Not Ready: 3 No Device: 0 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: ======================================================================================= Solaris: Quick Reference: Make New Filesystem newfs /dev/rdsk/cntndnsn Ref: http://rsusu1.rnd.runnet.ru/solaris2.7/Solaris_System_Administration_Guide-stripped/ch03/108-110.html ======================================================================================= Solaris: Quick Reference: NIS+ Group Membership nismatch user=userid netgroup.org_dir Hub_ACTUATE:::userid:: Hub_Personalization:::userid:: appengqt:::userid:: ======================================================================================= Solaris: Quick Reference: NIS+ Recovering From Dead NIS+ Master /etc/init.d/nscd stop /etc/init.d/rpc stop rm /var/nis/.NIS_PRIVATE_DIRCACHE rm /var/nis/NIS_SHARED_DIRCACHE /etc/init.d/rpc start /etc/init.d/nscd start ======================================================================================= Solaris: Quick Reference: NIS+ Search for User niscat passwd.org_dir | grep USERID ======================================================================================= Solaris: Quick Reference: OK Prompt via Telnet ~^b (that is: Shift ~ followed by CTRL-B) ======================================================================================= Solaris: Quick Reference: Prevent Dropping to OK prompt from keyboard Edit /etc/default/kbd and find the variable called KEYBOARD_ABORT Uncomment the lineas shown: KEYBOARD_ABORT=disable Then run the command "kbd -i" or simply reboot the system. The "kbd -i" command will force the system to reread the /etc/default/kbd file. This will permanently disable all the STOP+A and serial device break signals on the system. You can re-enable the break sequence by commenting out this line in the /etc/default/kbd file and rebooting the system or running the "kbd -i" command again. Ref: http://www.netsys.com/sunmgr/2001-08/msg00395.html ======================================================================================= Solaris: Quick Reference: Print OBP version % prtconf -V OBP 3.3.2 1996/06/28 08:43 % /usr/platform/`uname -i`/sbin/prtdiag -v | grep OBP OBP 3.11.1 1997/12/03 15:53 POST 3.11.4 1997/05/27 02:26 {2} ok .version Release 3.23 Version 1 created 1999/07/16 12:08 OBP 3.23.1 1999/07/16 12:08 POST 2.0.2 1998/10/19 10:46 {2} ok ======================================================================================= Solaris: Quick Reference: Processor type, speed % psrinfo -v Status of processor 0 as of: 06/16/99 12:38:51 Processor has been on-line since 02/07/99 01:47:11. The sparcv9 processor operates at 200 MHz, and has a sparcv9 floating point processor. ======================================================================================= Solaris: Quick Reference: Rescue CDROM Booting at the ok prompt: ok> boot cdrom -sw # mount the boot disk # mount /dev/dsk/c0t0d0s0 /mnt Perform repairs ======================================================================================= Solaris: Quick Reference: Sendmail Configuration /etc/mail/sendmail.cf sendmail configuration file. /etc/mail/aliases aliases file. Must run newaliases after modifying aliases file. Configure a mail server - Generate new configuration file cd /usr/lib/mail/cf cp main -v7sun.mc foo.mc /usr/ccs/bin/make foo.cf - Test new mail configuration file /usr/lib/sendmail –C foo.cf –v email_address wtmpx.ascii 4. Edit wtmpx.ascii to delete the corrupted records. 5. Convert the wtmpx.ascii file back to a binary file: # /usr/lib/acct/fwtmp -ic < wtmpx.ascii > wtmpx Same process works for wtmp ======================================================================================= Solaris: Set up OpenSSH http://www.sunfreeware.com/openssh8.html ======================================================================================= Solaris: Tar w/ exclude tar cvfX tarfile.tar exclude.file * exclude.file contains relative paths ======================================================================================= Solaris: Tips 1. Adding a user mkdir /export/home/gtoft useradd -c "name" -d /export/home/gtoft -g staff gtoft passwd gtoft 2. Backspace key fix stty erase ^H stty -a (provides all values) 3. Set history recall/edit keys to vi set -o vi ======================================================================================= Solaris: Truss Commands truss -la -o outfile -p pid truss -f -a -e -i -l -v all -r all -w all -p -o outfile -or- send output of truss and standard error to a file truss -f -a -e -i -l -d -v all -r all -w all -p JVM_PID_HERE > /logs/jsptruss.out 2>&1 ======================================================================================= Solaris: Turn IP Forwarding off ndd -set /dev/ip ip_forwarding 0 or set the corresponding variable in /etc/system. ======================================================================================= Solaris: Ultra2 -> 64bit mode edit /platform/sun4u/boot.conf uncomment line that says: ALLOW_64BIT_KERNEL_... ======================================================================================= Tripwire: Setup Untar tw in /root dir After install (install.sh), edit /etc/tripwire/twpol.txt Run "twadmin --create-polfile /etc/tripwire/twpol.txt" Run "tripwire --init" Put "tripwire --check" in a cron job ======================================================================================= Turn off echo: stty -echo ======================================================================================= Turn on echo: stty echo ======================================================================================= Unix Magic -To print one line of text: sed -n "${INDEX}p" filename (where INDEX is the line #) - Print the log entries dated Jul 1, 2003 or later from the access log: sed -n '/Jul\/2003:/,$p' access > access.new -n supresses normal output, /Jul\/2003:/ searches for "Jul/2003:" and the $p, in combination with the -n, prints everything in the file after the first match. - Solaris Files /usr/proc/bin/pmap -x /usr/proc/bin/pfiles - Solaris Open Boot Prom (OBP) ver prtconf -V - Analyze an AIX machine vmstat 5 100 iostat 5 100 - Analyze a Solaris machine vmstat 5 100 - Copy a filesystem tar cvBnf - | ( cd /whatever && tar xBnf - ) ======================================================================================= Unix: Copy Filesystem cd /whatever find . -depth -mount -print | cpio -pmdv /newlocation ======================================================================================= Unix: Redirection simple: cmd1 2> /dev/null combine stderr & stdout: cmd1 2>&1 | cmd2 stdout & stderr to diff files: cmd > f1 2> f2 -- George Toft, CISSP, MSIS AGD,LLC www.agdllc.com 623-203-1760 --------------------------------------------------- PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us To subscribe, unsubscribe, or to change you mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss