Tuesday, October 27, 2009

Change Group Ownership of Symbolic Links in Unix

By default, chown changes the ownership of the file pointed to by the link, not the link itself. If you need to change the link's owner/group, use the "-h" option.

-h If the file is a symbolic link, change the owner of
the symbolic link. Without this option, the owner of
the file referenced by the symbolic link is changed.

Ex: #chown -h root:root /etc/hosts

#chgrp -h new_group symbolic_link_name

Sunday, October 25, 2009

Networking

How do I find the speed my network card is at?

a. /usr/sbin/ndd -set /dev/hme instance 0
1. instance 0 - hme0
2. instance 1 - hme1
b. /usr/sbin/ndd -get /dev/hme transciever_inuse
1. 0 - onboard
2. 1 - offboard card (mii)
c. /usr/sbin/ndd -get /dev/hme link_status
1. 0 - down
2. 1 - up
d. /usr/sbin/ndd -get /dev/hme link_speed
1. 0 - 10Mb
2. 1 - 100Mb
e. /usr/sbin/ndd -get /dev/hme link_mode
1. 0 - half duplex
2. 1 - full duplex

2. How do I configure what my network card is capable of?

a. Method 1
1. /etc/system
a. this sets global defaults for the driver, therefore
it is effective for all instances of the card
b. HME/QFE/GE interfaces
1. set hme:hme_adv_autoneg_cap=0
a. advertise auto negotiate capability
b. 0 - off
c. 1 - on
2. set hme:hme_adv_100T4=0
a. advertise deprecated 100Mbit T4 capability
b. 0 - off
c. 1 - on
3. set hme:hme_adv_100fdx=0
a. advertise 100Mbit full duplex capability
b. 0 - off
c. 1 - on
4. set hme:hme_adv_100hdx=0
a. advertise 100Mbit half duplex capability
b. 0 - off
c. 1 - on
5. set hme:hme_adv_10fdx=0
a. advertise 10Mbit full duplex capability
b. 0 - off
c. 1 - on
6. set hme:hme_adv_10hdx=0
a. advertise 10Mbit half duplex capability
b. 0 - off
c. 1 - on
c. ERI interface
1. set eri:adv_autoneg_cap=0
a. advertise auto negotiate capability
b. 0 - off
c. 1 - on
2. set eri:adv_100T4=0
a. advertise deprecated 100Mbit T4 capability
b. 0 - off
c. 1 - on
3. set eri:adv_100fdx=0
a. advertise 100Mbit full duplex capability
b. 0 - off
c. 1 - on
4. set eri:adv_100hdx=0
a. advertise 100Mbit half duplex capability
b. 0 - off
c. 1 - on
5. set eri:adv_10fdx=0
a. advertise 10Mbit full duplex capability
b. 0 - off
c. 1 - on
6. set eri:adv_10hdx=0
a. advertise 10Mbit half duplex capability
b. 0 - off
c. 1 - on
c. QE/LE interfaces
1. these 10mbit interfaces dont support full duplex
operation
b. Method 2
1. This method allows more granular control over the interface
driver. You can specify configuration by port.
2. /usr/sbin/ndd -set /dev/hme instance 0
a. instance 0 - hme0
b. instance 1 - hme1
b. /usr/sbin/ndd -set /dev/hme adv_autoneg_cap 0
1. advertise auto negotiate capability
2. 0 - off
3. 1 - on
c. /usr/sbin/ndd -set /dev/hme adv_100fdx_cap 0
1. advertise 100Mbit full duplex capability
2. 0 - off
3. 1 - on
d. /usr/sbin/ndd -set /dev/hme adv_100hdx_cap 0
1. advertise 100Mbit half duplex capability
2. 0 - off
3. 1 - on
e. /usr/sbin/ndd -set /dev/hme adv_100T4_cap 0
1. advertise deprecated 100Mbit T4 capability
2. 0 - off
3. 1 - on
f. /usr/sbin/ndd -set /dev/hme adv_10fdx_cap 0
1. advertise 10Mbit full duplex capability
2. 0 - off
3. 1 - on
g. /usr/sbin/ndd -set /dev/hme adv_10hdx_cap 0
1. advertise 10Mbit half duplex capability
2. 0 - off
3. 1 - on

3. How do I configure what my link partner is capable of?

a. /usr/sbin/ndd -set /dev/hme instance 0
1. instance 0 - hme0
2. instance 1 - hme1
b. /usr/sbin/ndd -get /dev/hme lp_autoneg_cap
1. link partner has auto negotiate capability
2. 0 - off
3. 1 - on
c. /usr/sbin/ndd -get /dev/hme lp_100fdx_cap
1. link partner has 100Mbit full duplex capability
2. 0 - off
3. 1 - on
d. /usr/sbin/ndd -get /dev/hme lp_100hdx_cap
1. link partner has 100Mbit half duplex capability
2. 0 - off
3. 1 - on
e. /usr/sbin/ndd -get /dev/hme lp_100T4_cap
1. link partner has deprecated 100Mbit T4 capability
2. 0 - off
3. 1 - on
f. /usr/sbin/ndd -get /dev/hme lp_10fdx_cap
1. link partner has 10Mbit full duplex capability
2. 0 - off
3. 1 - on
g. /usr/sbin/ndd -get /dev/hme lp_10hdx_cap
1. link partner has 10Mbit half duplex capability
2. 0 - off
3. 1 - on

4. How can I tell if my card is active on the network?

a. Method 1 (Openboot PROM)
1. watch-net

5. How do I use multiple ethernet interfaces on the same network segment?

a. Method 1 (modern cards, 1997+)
1. Modern Sun Adapters have unique mac addresses encoded in the FCode Prom.
2. /usr/sbin/eeprom local-mac-address?=true

b. Method 2 (older cards)
1. From InfoDoc 16733; "Section 3.2.3(4) of the IEEE 802.3 spec
defines a reserved bit in the Ethernet Address that can be
used to administer a universally assigned ethernet
addresses. A Locally administered address (LAA) can be
implemented to ensure a unique HW address."
2. Setting the LAA bit can be done by using a 0A hex as the
first digit instead of 08.
3. /usr/sbin/ifconfig hme1 ether 0a:0:20:00:01

6. How do I determine if local mac addresses are in use on my host?

a. /usr/sbin/prtconf -pv | /usr/bin/grep local-mac-address

Veritas Volume Manager



1. How do I allow a user to write to a managed raw device?

a. /usr/bin/chown is not persistent across reboots
b. /usr/sbin/vxedit set user=oracle group=dba mode=600 volume

How do I use an alternate window manager?

a. Bypassing CDE
1. echo "exec /path/to/alternate/window/manager" > .xsession
b. Maintaining CDE
1. Xresources
a. cd /usr/dt/config/C/Xresources.d
b. /usr/bin/cp Xresources.ow Xresources.wm
c. Modify Xresources.wm
1. Dtlogin*altDtName: Alternate WindowManager
2. Dtlogin*altDtKey: /path/to/alternate/window/manager
3. Dtlogin*altDtStart: /usr/dt/config/Xsession.wm
4. Dtlogin*altDtLogo: WMlogo
2. Xsession
a. cd /usr/dt/config
b. /usr/bin/cp Xsession.ow Xsession.wm
c. Modify Xsession.wm
1. Place windowmanager environment
3. Logo (for display in CDE login)
a. cd /usr/dt/appconfig/icons/C
b. /usr/bin/cp OWlogo.pm WMlogo.pm
1. Replace this with your own XPM file

2. How do I disable X Windows from starting at boot?

a. Method 1 (recommended)
1. /usr/dt/bin/dtconfig -d
b. Method 2
1. /usr/bin/mv /etc/rc2.d/S99dtlogin /etc/rc2.d/s99dtlogin

How do I grow a ufs filesystem?

2. How do I grow a ufs filesystem?

a. Unmounted filesystem (not /, /usr, /var)
1. Allocate additional contiguous disk space with format(1m)
a. Unnecessary if you are using a volume manager
2. /usr/lib/fs/ufs/mkfs -G rawdevice newsize
b. Mounted filesytem (not /, /usr, /var)
1. Allocate additional contiguous disk space with format(1m)
a. Unnecessary if you are using a volume manager
2. /usr/lib/fs/ufs/mkfs -G -M mountpoint rawdevice newsize

3. How do I determine what type of filesystem a given device has?

a. Method 1 (root)
1. /usr/sbin/fstyp blockdevice


4. What are inodes 0, 1, and 2 used for?

a. Inode 0 is unusable. It is used to mark unused inodes.
b. Inode 1 is unusable. Use of this inode for bad block information
is deprecated.
c. Inode 2 is "/" or "root" of the filesystem.

5. What do I do if I have a corrupt boot block?

a. ok boot cdrom -s
b. /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rd

How do I add a disk to the system?

How do I add a disk to the system? 

a. While the system is up ( no fcal)
1. Solaris <= 7
a. Generate /devices structure
1. /usr/sbin/drvconfig
b. Generate /dev structure
1. /usr/sbin/devlinks
c. Generate /dev/dsk and /dev/rdsk links
1. /usr/sbin/disks
2. Solaris 8
a. Generate /devices, /dev, /dev/dsk, /dev/rdsk links
1. /usr/sbin/devfsadm
b. While the system is up ( fcal )
1. Get the enclosure name
a. /usr/sbin/luxadm probe
2. Add the disk
a. /usr/sbin/luxadm insert_device enclosure,slot
c. With a reboot
1. Method 1
a. /usr/sbin/shutdown -g0 -i0 "disk addition"
b. Reconfigure Boot (From OpenBoot PROM monitor)
1. boot -r
2. Method 2
a. /usr/bin/touch /reconfigure

How do I know the limits for shared memory kernel tunables?

 How do I know the limits for shared memory kernel tunables?

a. Read /usr/include/sys/shm.h

What is shared memory?

What is shared memory?

a. Just as it sounds. Shared memory is an Interprocess
Communication (IPC) mechanism used by multiple processes to
access common memory segments.

How do I list available signals?

 How do I list available signals?

a. /usr/bin/kill -l
b. Read /usr/include/sys/signal.h
c. Solaris 2.6/7
1. /usr/bin/man -s 5 signal
d. Solaris 8
1. /usr/bin/man -s 3HEAD signal

Ex:
bash-3.00# kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL
5) SIGTRAP 6) SIGABRT 7) SIGEMT 8) SIGFPE
9) SIGKILL 10) SIGBUS 11) SIGSEGV 12) SIGSYS
13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGUSR1
17) SIGUSR2 18) SIGCHLD 19) SIGPWR 20) SIGWINCH
21) SIGURG 22) SIGIO 23) SIGSTOP 24) SIGTSTP
25) SIGCONT 26) SIGTTIN 27) SIGTTOU 28) SIGVTALRM
29) SIGPROF 30) SIGXCPU 31) SIGXFSZ 32) SIGWAITING
33) SIGLWP 34) SIGFREEZE 35) SIGTHAW 36) SIGCANCEL
37) SIGLOST 41) SIGRTMIN 42) SIGRTMIN+1 43) SIGRTMIN+2
44) SIGRTMIN+3 45) SIGRTMAX-3 46) SIGRTMAX-2 47) SIGRTMAX-1
48) SIGRTMAX

How do I do a recursive grep?

How do I do a recursive grep?

a. Method 1 (recommended)
1. /usr/bin/find . | /usr/bin/xargs /usr/bin/grep PATTERN
2. displays filename:match
b. Method 2 (recommended)
1. /usr/bin/find . -exec /usr/bin/grep PATTERN {} /dev/null \;
2. displays filename:match

Ex:
bash-3.00# find /tmp | xargs grep "RTMAX"
/tmp/nsig:RTMAX-3 default
/tmp/nsig:RTMAX-2 default
/tmp/nsig:RTMAX-1 default
/tmp/nsig:RTMAX default

What is load?

1. What is load?

a. Load is the number of processes currently in the run queue.
b. Method 1
1. /usr/bin/w -u
2. displays load average over last 1, 5 and 15 minutes
c. Method 2
1. /usr/bin/uptime
2. displays load average over last 1, 5 and 15 minutes