Monday, May 21, 2012

Alternatives usage


Alternatives allows you to toggle between several version of the installed binary using symlink. Alternatives has a default administrative directory as /var/lib/alternatives where it keeps all the metadata


Most common usage of alternatives are
alternatives --install
alternatives --config
alternatives --remove

usage: alternatives --install
update-alternatives --install "/usr/bin/java" "java" "/usr/java/default/bin/java" 3

lrwxrwxrwx. 1 root root 12 Feb 22 20:04 /usr/sbin/update-alternatives -> alternatives

ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 35 Jun  8  2010 /etc/alternatives/java -> /usr/lib/jvm/jre-1.4.2-gcj/bin/java


[root@pg ~]# alternatives --config java

There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java


update-alternatives --install /usr/bin/java java /usr/bin/jade 3

[root@pg ~]# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
   2           /usr/bin/jade

Enter to keep the current selection[+], or type selection number:



[root@pg ~]# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
 + 2           /usr/bin/jade

Enter to keep the current selection[+], or type selection number:


[root@pg ~]# ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 13 Apr 24 01:33 /etc/alternatives/java -> /usr/bin/jade



Why apache shows multiple processes?


The multiple apache processes we see is by design to handle multiple requests. Those multiple processes is basically listeners with multiple threads, so that it can handle simultaneous traffic more efficiently.

By default, apache spawns10 processes and each process generally takes about 10MB. Assuming all the sub processes takes the same memory its about 100MB for apache running on a machine.

Example of apache running:
#top -U nobody

Memory: 8064M phys mem, 2620M free mem, 12G total swap, 9550M free swap

   PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
 14436 nobody     1  59    0   12M 3272K sleep    0:09  0.00% httpd
 14435 nobody     1  59    0   12M 3232K sleep    0:08  0.00% httpd
 17184 nobody     1  59    0   12M 4488K sleep    0:06  0.00% httpd
 14437 nobody     1  59    0   12M 4152K sleep    0:06  0.00% httpd
 17182 nobody     1  59    0   12M 4040K sleep    0:06  0.00% httpd
 14439 nobody     1  59    0   12M 3272K sleep    0:06  0.00% httpd
 16956 nobody     1  59    0   12M 4032K sleep    0:05  0.00% httpd
 14438 nobody     1  59    0   12M 3272K sleep    0:04  0.00% httpd
 17579 nobody     1  59    0   12M 3208K sleep    0:04  0.00% httpd
 17183 nobody     1  59    0   12M 3144K sleep    0:03  0.00% httpd



The defaults in httpd.conf include :


StartServers 8

MinSpareServers 5

User apache


That means start 8 listeners (total 9 processes - root httpd process + 8 servers) and have a minimum of 5 idle listeners at all times (dynamically creating new listeners as necessary). The 'User' directive controls which non-root account the listeners run as (usually 'apache' or 'nobody').

There are lots of other related directives but, unless you have low traffic and are trying to save memory, I wouldn't recommend changing the defaults.

Thursday, April 5, 2012

sar reports different device than the actual storage lun

How do we know, how is the storage devices are mapped to local devices?

bash-3.00# sar -d 2
SunOS mdc4ps001 5.10 Generic_144488-14 sun4v 04/05/2012 17:36:49
device %busy avque r+w/s blks/s avwait avserv
ssd19 0 0.0 1 178 0.0 4.8
ssd19,a 0 0.0 1 178 0.0 4.8
ssd19,h 0 0.0 0 0 0.0 0.0


devices export from SAN
output of QFS mcf
/dev/dsk/c6t600A0B800047157000001D0E4EBACAD5d0s0
/dev/dsk/c6t600A0B800047157000001D124EBACF17d0s0
/dev/dsk/c6t600A0B800047157000001D164EBACFECd0s0

output of format
1. c6t600A0B800047157000001D0E4EBACAD5d0
/scsi_vhci/ssd@g600a0b800047157000001d0e4ebacad5
2. c6t600A0B800047157000001D124EBACF17d0
/scsi_vhci/ssd@g600a0b800047157000001d124ebacf17
3. c6t600A0B800047157000001D164EBACFECd0
/scsi_vhci/ssd@g600a0b800047157000001d164ebacfec

Steps:
#1. Look at /etc/path_to_install for device "19"
bash-3.00# cat /etc/path_to_inst | grep 19
"/scsi_vhci/ssd@g600a0b800047157000001d124ebacf17" 19 "ssd"

#2. Here we are looking for device ending with f17 to be ssd19

Wednesday, November 16, 2011

Quest Samba on Solaris 10 using AD authentication

Download Quest packages from:
http://rc.quest.com/downloads.php?release=quest-samba-3.0.34

Disable existing samba:
# svcs -a | grep samba
disabled Oct_13 svc:/network/samba:default

For Solaris 10, we need these packages
bash-3.00# uname -a
SunOS mdc2ps005 5.10 Generic_141444-09 sun4v sparc SUNW,SPARC-Enterprise-T5120 Solaris

#1. QSFTsmb-3.0.34-2-sparc.pkg
#2. QSFTidmap-1.2.2-sparc.pkg


Install QSFTsmb
bash-3.00# pkgadd -d /home/pkg/QSFTsmb-3.0.34-2-sparc.pkg

Output of installation:
The following packages are available:
1 QSFTsmb quest-samba 3.0.34
(sparc) 3.0.34

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:

Processing package instance from

quest-samba 3.0.34(sparc) 3.0.34
(c) 2006 Samba Team, (c) 2006 Quest Software Inc. All rights rsvd

Do you want to install the development files [y,n,?,q] y

Do you want to install nmbd-quest service [y,n,?,q] y

Do you want to install smbd-quest service [y,n,?,q] y

Do you want to install winbindd-quest service [y,n,?,q] y
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.

The following files are already installed on the system and are being
used by another package:
/opt/quest/man/man1
/opt/quest/man/man5
* /opt/quest/man/man8

* - conflict with a file which does not belong to any package.

Do you want to install these conflicting files [y,n,?,q] y
## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user
permission during the process of installing this package.

Do you want to continue with the installation of [y,n,?] y

Installing quest-samba 3.0.34 as

## Installing part 1 of 1.
/opt/quest/include/libmsrpc.h
/opt/quest/include/libsmbclient.h
[ verifying class ]
/etc/init.d/nmbd-quest
/etc/init.d/samba-quest
/etc/init.d/d-quest
/etc/init.d/winbindd-quest
/etc/opt/quest/samba/smb.conf
/lib/security/pam_smbpass.so
/lib/security
/opt/quest/bin/eventlogadm
/opt/quest/bin/findsmb
/opt/quest/bin/net
/opt/quest/bin/nmblookup
/opt/quest/bin/ntlm_auth
/opt/quest/bin/pdbedit
/opt/quest/bin/profiles
/opt/quest/bin/rpcclient
/opt/quest/bin/smbcacls
/opt/quest/bin/smbclient
/opt/quest/bin/smbcontrol
/opt/quest/bin/smbcquotas
/opt/quest/bin/smbget
/opt/quest/bin/smbpasswd
/opt/quest/bin/smbspool
/opt/quest/bin/smbstatus
/opt/quest/bin/smbtar
/opt/quest/bin/smbtree
/opt/quest/bin/tdbbackup
/opt/quest/bin/tdbdump
/opt/quest/bin/tdbtool
/opt/quest/bin/testparm
/opt/quest/bin/wbinfo
/opt/quest/lib/samba/auth/script.so
/opt/quest/lib/samba/charset/CP437.so
/opt/quest/lib/samba/charset/CP850.so
/opt/quest/lib/samba/de.msg
/opt/quest/lib/samba/en.msg
/opt/quest/lib/samba/fi.msg
/opt/quest/lib/samba/fr.msg
/opt/quest/lib/samba/it.msg
/opt/quest/lib/samba/ja.msg
/opt/quest/lib/samba/libmsrpc.so
/opt/quest/lib/samba/libsmbclient.so
/opt/quest/lib/samba/libsmbsharemodes.so
/opt/quest/lib/samba/lowcase.dat
/opt/quest/lib/samba/nl.msg
/opt/quest/lib/samba/pl.msg
/opt/quest/lib/samba/tr.msg
/opt/quest/lib/samba/upcase.dat
/opt/quest/lib/samba/valid.dat
/opt/quest/lib/samba/vfs/audit.so
/opt/quest/lib/samba/vfs/cap.so
/opt/quest/lib/samba/vfs/default_quota.so
/opt/quest/lib/samba/vfs/expand_msdfs.so
/opt/quest/lib/samba/vfs/extd_audit.so
/opt/quest/lib/samba/vfs/fake_perms.so
/opt/quest/lib/samba/vfs/full_audit.so
/opt/quest/lib/samba/vfs/netatalk.so
/opt/quest/lib/samba/vfs/readahead.so
/opt/quest/lib/samba/vfs/readonly.so
/opt/quest/lib/samba/vfs/recycle.so
/opt/quest/lib/samba/vfs/shadow_copy.so
/opt/quest/man/man1/findsmb.1
/opt/quest/man/man1/log2pcap.1
/opt/quest/man/man1/nmblookup.1
/opt/quest/man/man1/ntlm_auth.1
/opt/quest/man/man1/profiles.1
/opt/quest/man/man1/rpcclient.1
/opt/quest/man/man1/smbcacls.1
/opt/quest/man/man1/smbclient.1
/opt/quest/man/man1/smbcontrol.1
/opt/quest/man/man1/smbcquotas.1
/opt/quest/man/man1/smbget.1
/opt/quest/man/man1/smbstatus.1
/opt/quest/man/man1/smbtar.1
/opt/quest/man/man1/smbtree.1
/opt/quest/man/man1/testparm.1
/opt/quest/man/man1/vfstest.1
/opt/quest/man/man1/wbinfo.1
/opt/quest/man/man5/lmhosts.5
/opt/quest/man/man5/smb.conf.5
/opt/quest/man/man5/smbgetrc.5
/opt/quest/man/man5/smbpasswd.5
/opt/quest/man/man7/libsmbclient.7
/opt/quest/man/man7/pam_winbind.7
/opt/quest/man/man7/samba.7
/opt/quest/man/man8/cifs.upcall.8
/opt/quest/man/man8/eventlogadm.8
/opt/quest/man/man8/idmap_ad.8
/opt/quest/man/man8/idmap_ldap.8
/opt/quest/man/man8/idmap_nss.8
/opt/quest/man/man8/idmap_rid.8
/opt/quest/man/man8/idmap_tdb.8
/opt/quest/man/man8/mount.cifs.8
/opt/quest/man/man8/net.8
/opt/quest/man/man8/nmbd.8
/opt/quest/man/man8/pdbedit.8
/opt/quest/man/man8/smbd.8
/opt/quest/man/man8/smbpasswd.8
/opt/quest/man/man8/smbspool.8
/opt/quest/man/man8/swat.8
/opt/quest/man/man8/tdbbackup.8
/opt/quest/man/man8/tdbdump.8
/opt/quest/man/man8/tdbtool.8
/opt/quest/man/man8/umount.cifs.8
/opt/quest/man/man8/vfs_audit.8
/opt/quest/man/man8/vfs_cacheprime.8
/opt/quest/man/man8/vfs_cap.8
/opt/quest/man/man8/vfs_catia.8
/opt/quest/man/man8/vfs_commit.8
/opt/quest/man/man8/vfs_default_quota.8
/opt/quest/man/man8/vfs_extd_audit.8
/opt/quest/man/man8/vfs_fake_perms.8
/opt/quest/man/man8/vfs_full_audit.8
/opt/quest/man/man8/vfs_gpfs.8
/opt/quest/man/man8/vfs_netatalk.8
/opt/quest/man/man8/vfs_notify_fam.8
/opt/quest/man/man8/vfs_prealloc.8
/opt/quest/man/man8/vfs_readahead.8
/opt/quest/man/man8/vfs_readonly.8
/opt/quest/man/man8/vfs_recycle.8
/opt/quest/man/man8/vfs_shadow_copy.8
/opt/quest/man/man8/vfs_xattr_tdb.8
/opt/quest/man/man8/winbindd.8
/opt/quest/sbin/nmbd
/opt/quest/sbin/smbd
/opt/quest/sbin/swat
/opt/quest/sbin/winbindd
[ verifying class ]
## Executing postinstall script.
/etc/rc2.d/S98nmbd-quest
/etc/rcS.d/K30nmbd-quest
/etc/rc0.d/K30nmbd-quest
/etc/rc1.d/K30nmbd-quest
/etc/rc2.d/S98smbd-quest
/etc/rcS.d/K30smbd-quest
/etc/rc0.d/K30smbd-quest
/etc/rc1.d/K30smbd-quest
/etc/rc2.d/S98winbindd-quest
/etc/rcS.d/K30winbindd-quest
/etc/rc0.d/K30winbindd-quest
/etc/rc1.d/K30winbindd-quest
Installation of was successful.




Install vasidmap
bash-3.00# pkgadd -d /home/pkg/QSFTidmap-1.2.2-sparc.pkg

The following packages are available:
1 QSFTidmap quest-vasidmap 1.2.2
(sparc) 1.2.2

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:

Processing package instance from

quest-vasidmap 1.2.2(sparc) 1.2.2
Copyright 2010 Quest Software, Inc. All rights reserved.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user
permission during the process of installing this package.

Do you want to continue with the installation of [y,n,?] y

Installing quest-vasidmap 1.2.2 as

## Installing part 1 of 1.
/etc/init.d/vasidmapd
/opt/quest/bin/vasidmap
/opt/quest/libexec/vas-set-samba-password
/opt/quest/libexec/vasidmap-status
/opt/quest/sbin/vas-krb5-config
/opt/quest/sbin/vas-samba-config
/opt/quest/sbin/vasidmapd
/opt/quest/share/man/man1/vas-krb5-config.1
/opt/quest/share/man/man1/vas-samba-config.1
/opt/quest/share/man/man1/vasidmap.1
/opt/quest/share/man/man8/vas-set-samba-password.8
/opt/quest/share/man/man8
/opt/quest/share/man/man8/vasidmapd.8
/opt/quest/share/quest-vasidmap/vasidmap-common.sh
/opt/quest/share/quest-vasidmap
[ verifying class ]
## Executing postinstall script.
Registering vasidmapd with SMF

Installation of was successful.

Configure krb and update smb config:
bash-3.00#/opt/quest/sbin/vas-samba-config
bash-3.00# /opt/quest/sbin/vas-krb5-config


Copy the right smb config file
/etc/opt/quest/samba/smb.conf
Sample smb.conf below....

Start samba services:
/etc/init.d/vasidmapd start
/etc/init.d/samba-quest start



-------------------------------------------
# cat smb.conf
[global]
workgroup = PANKAJGAUTAM
server string = PG Samba Server
security = ads
realm = PANKAJGAUTAMG.COM
auth methods = winbind guest sam
use kerberos keytab = yes
winbind refresh tickets = true
use spnego = yes
machine password timeout = 0

# winbind configuration
# winbind separator is default set to '' - so it is fine

winbind normalize names = yes
#winbind separator = +
winbind use default domain = no
winbind enum users = yes
winbind enum groups = yes
#winbind nss info = template
winbind nss info = sfu

idmap domains = PANKAJGAUTAM

idmap config PANKAJGAUTAM:backend = rid
idmap config PANKAJGAUTAM:base_rid = 500
#idmap config PANKAJGAUTAM:default = yes
idmap config PANKAJGAUTAM:readonly = yes
idmap config PANKAJGAUTAM:range = 100000 - 19999999999999
idmap uid = 1000 - 5999999999
idmap gid = 1000 - 5999999999
idmap config PANKAJGAUTAM:schema = rfc 2307
idmap alloc backend = tdb
idmap alloc config:range = 1000 - 1000000000


ldap admin dn = CN=VasIdmapAdmin

username map script = /opt/quest/bin/vasidmap

invalid users = root bin daemon lp sys tty

log file = /var/samba/log/log.%m
log level = 3 printdrivers: 0 lanman: 0 smb: 1 rpc_parse: 0 rpc_srv: 0 rpc_cl
i: 0 passdb: 1 sam: 0 auth: 5 winbind: 5 vfs: 0 idmap: 0 quota: 0 acls: 0 loc
king: 0 msdfs: 0 dmapi: 0

max log size = 1024

#============================ Share Definitions ==============================

;--- begin options added by vasidmap-config (20110930) ---
idmap backend = ldap:ldap://localhost
;--- end options added by vasidmap-config (20110930) ---

idmap cache time = 300 # Expire the tdb cache every 5 minutes

;--- begin options added by vas-samba-config (20110930) ---
domain master = no
domain logons = no
obey pam restrictions = yes
;--- end options added by vas-samba-config (20110930) ---


;--- begin options added by vas-samba-config (20111115) ---
winbind nested groups = no
;--- end options added by vas-samba-config (20111115) ---

[Data]
comment = Data Stuff
path = /var/data/
public = yes
writable = yes
printable = no
force grcup = dam
directory mask = 775
force create mode = 775
force directory mode = 775