Monday 23 May 2011

BASIC UNIX COMMANDS

Basic Unix Commands:
1. Getting Started to UNIX
    - Different Versions and Flavors of UNIX Operating System with their features
2. Comparison between Windows & Unix
3. Unix Structures
    - Operating System
    - File System
    - Unix Directories files and inodes
4. Shell
   - Types of Shell's in Unix
   - Features of Shell
5. Basic Unix Commands
  i. Creation and Deletion of Files with different options
  ii. Working with Directories
     - Making / Deleting/ Renaming of Directories
 iii. Copying Files & Directories
 iv. Special Directory Names

6. Listing of Files & Directories
   i. Searching of Files & Directories using find command.
  ii. Wild Card Characters
 iii. Investigation of the system
 iv. File Access Permissions
     - Absolute / Numeric Method
     - Symbolic Method ( both at file level and directory level)
7. Vi - Editor
   - Introduction
   - Different Modes in Vi (Command mode, insert mode, escape mode)
   - Vi command reference
8. Linking Files
    - Soft link
    - Hard link
    - Removing link
9. Creating/Deleting of User accounts
    - Contents of User Account
    - Password Tips
    - Changing Password
10. Types of Filters
    - Simple Filters (more, less, head, tail, sort, paste, wc, tr, diff, cut, comm)
    - Advanced Filters (sed, grep, find & awk)
11. Process Scheduling
    - System Process
    - Killing the Process
    - Background Process
    - Foreground Process
12. Communication Options (write, talk, mesg, wall & mail)
13. Other Useful Commands.




Saturday 21 May 2011

SVM (Solaris Volume Manager)

SVM:
The main point of the SVM is to eliminate physical disk restrictions which can be done by enabling RAID (Redundant Array of Independent or Inexpensive Disk)

Types of RAID
1. Hard Ware RAID: It is basically a setup with a device called 'Disk Array' where multiple disks are connected and it doesn't depend on the software.
2. Software RAID: A software RAID can be done with a package called ODS which is also called as SVM.
- A software RAID is OS dependent
- In software RAID if the OS is crashed the entire RAID setup is disturbed.

Different kinds of RAID levels:
1. RAID - 0
    i. Concatenation (sequential)
    ii. Stripping ( alternatively & evenly)

2. RAID - 1: mirroring (simultaneously)
3. RAID - 5: stripping + parity

Meta Device:
A meta device is a logical device which is created by clubbing two or more physical disk.
State data base: It is a database that maintain RAID configuration and meta device information.
with out a STATE Data Base that RAID can't be configured.

1. RAID - 0:
i. concatenation:
 1. min disk required = 2
     max disk required = 32
 2. Data will be written " sequentially" into '2' or more disk.
     i.e. It first fills the 1st disk and then it will go automatically to 2nd disk and fill it.
 3. read / write speed is normal
 4. no fault tolerance
 5. spanning is available
  ( the ability to write the data into multiple disk )

ii. RAID - 0 ( Stripping):
1. min disk required = 2 disk
    max disk required = 32 disk
2. The Data is written alternatively and evenly into two or more disk
3. RW speed is faster
4. No fault tolerance
5. spanning is available.

2. RAID - 1 ( mirroring):
1. min disk required = 2
    max disk (recommended) = 3
2. Data is written simultaneously into more disk
3. Read speed is faster, write speed is slower
4. Fault tolerance is available
5. Spanning is available

dis adv:
If data deleted in one disk the same data is deleted in other disk also.

How to take backup:
1. Detach & take online backup
2. If you write as any data in d2, e,f,g,h it will written in c0d0, but not in c0d1 because it is detached.
3. If i attach c0d1 resync occur, same data e,f,g,h, stored in c0d1 automatically.
4. If detached c0d1 take online backup, now c0d0 got crashed then no use of c0d1, so no resync, at this time we take 'mirror' (d3)..

3. RAID - 5 ( Stripping with parity):
1. min disk required = 3
    max disk required = 32
2. Data is written alternately and evenly and the parity is written in other disk.
    ( in real time parity is included in A & B)
3. rw speed is faster
4. Fault tolerance is available.
5. Spanning available.
6. all the disk should be of equal size.

RAID - 5 (Striping with parity):
parity size = Total size of the disks / No. of disk = 90/3=30
                   = 30 /3 = 10 gb
(A+B+C) - parity size =90 - 30 = 60 gb

1. order to write the data alternate & evenly into two (or) more disks we need a Interlace value.
- By default the interlace value is 32 blocks (16kbs)










Friday 20 May 2011

Back up of a File System in mounted state: snapshot


Back up of a File System in mounted state:
task:
-if suppose my boss said, it should be mounted only  /jumbo and i want back up & don't want any updates.
ans: fssnap                    // snap shot
- user can't accessible until snap shot.

Back up of a File System in mounted state:
- To take a backup of a File System in mounted state the option used is 'snap shot'
- while taking a 'snap shot' all the users will face a 'pause mode'. i.e they can view the File System, but they can't update the data to the File System.
- To create a File System, Format it, mount it & write the data into the mount point.

# Format                // take slice s6, 100m size
# newfs /dev/rdsk/c0t0d0s6
# mkdir /joy
# mount /dev/dsk/c0t0d0s6 /joy
# cd /joy
# touch j1 j2 j3 j4 j5
# ls
# df -h
  s6   (mounted state)

To create a snap shot:
# fssnap -F ufs -o bs=/var/tmp  /joy           // F- file

/dev/fssnap/0 : snap shot is a image of slice only ( it's not a backup, it is only a image, whatever file in s6 that will be in snap shot)

to verify a snapshot:
# mkdir /toy
# mount -F ufs -o -ro /dev/fssnap/0 /toy
# df -h
/s6   -   /joy
/dev/fssnap/0  -  /toy
# cd /joy
# ls
# cd /toy
# ls

//both have same data in joy & toy, so successfully taken of snap shot

to take a backup of a snapshot:
#  umount /toy

backup:
# ufsdump 0uf /dev/rmt/0 /dev/fssnap/0

till now 3 copies done
1. s6
2. /dev/fssnap/0
3. /dev/rmt/0

verify:
# cat /etc/dumpdates

to verify the backup & recover:
# fssnap -i
0  /joy

to date the snapshot:
# fssnap -d /joy
// deleted snapshot 0

# fssnap -i
//no snap shots

# umount /joy
# newfs /dev/rdsk/c0t0d0s6
// data lost

# mount /dev/dsk/c0t0d0s6 /joy
# cd /joy
# ls
// nothing, bcoz its formated

to recover the data:
# ufsrestore rvf /dev/rmt/0

check:
# df -h
# cd /joy
# ls
(yes, all recovered)

Note: when we recover the data by using 'ufsrestore' bydefault we are setting one directory 

Sunday 15 May 2011

File System Backup

File System Backup:
- It is used to take a backup of the file system
- File system backup can be taken in two modes
  1. mounted state
  2. unmounted state

- command used for backup & restore
  1. ufsdump: It is used to take a backup of File System
  2. ufsrestore: It is used to recover the backup.

types of backups
 1. full backup: It will take a backup of all the files & directories
 2. incremental backup: it is used to take a backup of user created (or) newly modified file.

Note: To identify the backups we use numbers from 0-9
where '0' represents full backup
and '1-9' represents incremental backup

1. to take a backup of the File System which is in unmounted state:
step1: create a File System, Format it, and mount it, and write some data into the mount point
s4 having - 100mb
 # newfs /dev/rdsk/c0t0d0s4
 # mkdir /jumbo
 # mount /dev/dsk/c0t0d0s4 /jumbo
 # df -h
 # cd /jumbo
 # touch j1 j2 j3 j4 j5 j6
 # ls

to take a backup:
1. unmount the FileSystem:
 # umount /jumbo

2. take a backup:
 # ufsdump Ouf /dev/rmt/0  /dev/rdsk/c0t0d0s4
 //dump is done, level 0 dumped on wed apr 7:40 pm

Note: while taking a backup in option we can use 'u' option for update a file called /etc/dumpdates
# cat /etc/dumpdates
/dev/rdsk/c0t0d0s4   0 wed apr13 7:40pm

after this what ever file you updated comes under I.B (suppose if you delete s4, we can recover from /dev/rmt/0

to verify the backup & recovery format the slice:
# newfs /dev/rdsk/c0t0d0s4
# mount /dev/dsk/c0t0d0s4 /jumbo
# df -h
(s4 slice visible now)
# cd /jumbo
# ls
(no file bcoz we format it)
to recover: ufs restore:
to view files (check)
# ufsrestore tvf  /dev/rmt/0

to restore:
# ufsrestore rvf  /dev/rmt/0
# ls
# pwd
/jumbo

note: backup mean Filesystem should be unmounted


Back up of a File System in mounted state:
task:
-if suppose my boss said, it should be mounted only  /jumbo and i want back up & don't want any updates.
ans: fssnap                    // snap shot
- user can't accessible until snap shot.

Back up of a File System in mounted state:
- To take a backup of a File System in mounted state the option used is 'snap shot'
- while taking a 'snap shot' all the users will face a 'pause mode'. i.e they can view the File System, but they can't update the data to the File System.
- To create a File System, Format it, mount it & write the data into the mount point.

# Format                // take slice s6, 100m size
# newfs /dev/rdsk/c0t0d0s6
# mkdir /joy
# mount /dev/dsk/c0t0d0s6 /joy
# cd /joy
# touch j1 j2 j3 j4 j5
# ls
# df -h
  s6   (mounted state)

To create a snap shot:
# fssnap -F ufs -o bs=/var/tmp  /joy           // F- file

/dev/fssnap/0 : snap shot is a image of slice only ( it's not a backup, it is only a image, whatever file in s6 that will be in snap shot)

to verify a snapshot:
# mkdir /toy
# mount -F ufs -o -ro /dev/fssnap/0 /toy
# df -h
/s6   -   /joy
/dev/fssnap/0  -  /toy
# cd /joy
# ls
# cd /toy
# ls

//both have same data in joy & toy, so successfully taken of snap shot

to take a backup of a snapshot:
#  umount /toy

backup:
# ufsdump 0uf /dev/rmt/0 /dev/fssnap/0

till now 3 copies done
1. s6
2. /dev/fssnap/0
3. /dev/rmt/0

verify:
# cat /etc/dumpdates

to verify the backup & recover:
# fssnap -i
0  /joy

to date the snapshot:
# fssnap -d /joy
// deleted snapshot 0

# fssnap -i
//no snap shots

# umount /joy
# newfs /dev/rdsk/c0t0d0s6
// data lost

# mount /dev/dsk/c0t0d0s6 /joy
# cd /joy
# ls
// nothing, bcoz its formated

to recover the data:
# ufsrestore rvf /dev/rmt/0

check:
# df -h
# cd /joy
# ls
(yes, all recovered)

Note: when we recover the data by using 'ufsrestore' bydefault we are setting one directory
i.e. restorsymtable.
# cat

CPIO

CPIO: (Copy Input Output):
TAR: There is no Filter
o = It reads the files from system to output library
O= It is used to redirect the data to the required location. i.e. /dev/rmt/0
i = It reads the data from backup tapes to input libray
I = It reads the data from standard output instead of input libray
 ex: data transfer rate: 512 Bytes
B = it is a blocking factor which reads 5120 bytes instead of 512 bytes.

CPIO supports only relative backup:
Advantage of CPIO:
1. It supports multiple tapes
2. If any bad sector is found on the tape it will try to eliminates the bad sector.
ex:
# mkdir /jogi
# cd /jogi
# touch j1  j2 j3
# ls
j1 j2 j3
# pwd
/jogi
backup: (directory for relative should  in present working)
# ls | cpio -ocvf -O /dev/rmt/0

check the backup:
# cpio -itvf -I /dev/rmt/0

# mkdir /sita
# cd /sita

to restore the backup:
# cpio -icvf -I /dev/rmt/0

note: for backup  o,O
        for recover: i, I
Some discrete symbols for cpio:
 'O' replace with '>'
 'I'  replace with '<'

to take a backup & restore by using re discrete symbols:
 # mkdir /john
 # cd /john
 # touch l1 l2 l3
 # ls
  l1 l2 l3
  # pwd

# find .| cpio -ocB>/dev/rmt/0

now two copies create & /john

To recover the data:
# mkdir /david
 # cd /david
 # cpio -icvdB</dev/rmt/0         // d- directory
as of now we have taken whole files of directory

Interactive backup:
It is used to take a backup of a specified files in the directory

ex: # mkdir /ahmed
    # cd /ahmed
    # touch a1 a2 a4 a5 a3
   
now i want to take the backup of only two files:
# cpio -oB>/dev/rmt/0
 -- type here--
    a1
    a2
   ctrl+D

# mkdir /johny
# cd /johny

to recover (only two files recover now)

# cpio -iB</dev/rmt/0
# ls
a1 a2

assignment:
how to recover a single file from a tape drive, where the tape drive have 10 files?
to copy or back of limited files of 5
l1 l2 l3 l4 l5
# cpio -ocvf -O /dev/rmt/0
l1
l2
ctrl+D

# cpio -iB -I /dev/rmt/0 l1
only l1 file extracted







 




Saturday 14 May 2011

Backup & Restore

Backup: It is an option in which we can store the data in any removal devices.
Restore: Restore is an option in which we can restore the data when some one has accidentally deleted the data.
Types of TAPES user for backup:
QIC: Quarter Inch catrage
DAT: Digital Analog Tape
DLT: Digital Linear Tape
SDLT: Silicon Digital Linear Tape

Types of backup:
1. File Backup
2. File System backup

1. File Backup:
We used to take a backup of files & directories in the system. then a different switches which are used to take file backup.
1. TAR
2. CPIO
types:
1. Absolute backup: It is used to take a backup of file and directories that can be restored to the same location.
2. Relative backup: It is used to take a backup of file and directories that can be restored to any other location.

1. TAR (TAPE Archive):
1. It supports both absolute and relative backups.
2. It doesn't support multiple tape, the backup can be taken to the single tape.
3. If any bad sectors are found in a tape the backup stops there itself. It doesn't move forward.

Syntax for TAR:
tar <options> <destination> <source>
ex: tar cvf /dev/rmt/0 /data

Options:
c- create or copy
v- verbose
f- files
t- tables
x- extract or restore
r- replace
u- update

check the backup:
# tar tvf /dev/rmt/0

extract backup:
# tar xvf /dev/rmt/0

1. Absolute backup:
1. mkdir /sun
2. cd /sun
3. touch s1 s2 s3 s4 s5
4. cd
taking the backup from root (/) of /sun is absolute backup
taking the backup from /sun of /sun is relative backup

Note: to take an absolute backup your present working directory that is other than the directory which your taking a backup.

to recover: same location
for backup: should be root (/)

2. Relative backup: should be present working directory only.
#pwd
/sun

ex: of absolute:
# tar cvf /dev/rmt/0 /sun/*
now data in two drive it stores in /sun, /dev/rmt/0
to check the backup:
# tar tvf /dev/rmt/0

now remove /sun:
# rm -r /sun
# ls
no /sun

now can you recover data?
yes, from /dev/rmt/0

to recover the data:
# tar xvf /dev/rmt/0

note: not giving any source but it save in /sun only because absolute.
# ls
(sun is there)

relative backup:
# mkdir /data
# cd /data
# pwd
/data
# touch d1 d2 d3 d4
# ls
d1 d2 d3 d4
# tar cvf /dev/rmt/0 .

check the backup:
# tar tvf /dev/rmt/0
# cd /mnt
# tar xvf /dev/rmt/0
now 3 copes /data, /dev/rmt/0, /mnt


CPIO: (Copy Input Output):
TAR: There is no Filter
o = It reads the files from system to output library
O= It is used to redirect the data to the required location. i.e. /dev/rmt/0
i = It reads the data from backup tapes to input libray
I = It reads the data from standard output instead of input libray
 ex: data transfer rate: 512 Bytes
B = it is a blocking factor which reads 5120 bytes instead of 512 bytes.

CPIO supports only relative backup:
Advantage of CPIO:
1. It supports multiple tapes
2. If any bad sector is found on the tape it will try to eliminates the bad sector.
ex:
# mkdir /jogi
# cd /jogi
# touch j1  j2 j3
# ls
j1 j2 j3
# pwd
/jogi
backup: (directory for relative should  in present working)
# ls | cpio -ocvf -O /dev/rmt/0

check the backup:
# cpio -itvf -I /dev/rmt/0

# mkdir /sita
# cd /sita

to restore the backup:
# cpio -icvf -I /dev/rmt/0

note: for backup  o,O
        for recover: i, I
Some discrete symbols for cpio:
 'O' replace with '>'
 'I'  replace with '<'

to take a backup & restore by using re discrete symbols:
 # mkdir /john
 # cd /john
 # touch l1 l2 l3
 # ls
  l1 l2 l3
  # pwd

# find .| cpio -ocB>/dev/rmt/0

now two copies create & /john

To recover the data:
# mkdir /david
 # cd /david
 # cpio -icvdB</dev/rmt/0         // d- directory
as of now we have taken whole files of directory

Interactive backup:
It is used to take a backup of a specified files in the directory

ex: # mkdir /ahmed
    # cd /ahmed
    # touch a1 a2 a4 a5 a3
    
now i want to take the backup of only two files:
# cpio -oB>/dev/rmt/0
 -- type here--
    a1
    a2
   ctrl+D

# mkdir /johny
# cd /johny

to recover (only two files recover now)

# cpio -iB</dev/rmt/0
# ls
a1 a2

assignment:
how to recover a single file from a tape drive, where the tape drive have 10 files?
to copy or back of limited files of 5
l1 l2 l3 l4 l5
# cpio -ocvf -O /dev/rmt/0
l1 
l2
ctrl+D

# cpio -iB -I /dev/rmt/0 l1
only l1 file extracted














Thursday 12 May 2011

Volume Management : vold

- when u insert CD, it mounted automatically
# df -h
cd monted now

#vold (volume daemon)
# /usr/sbin/vold  (location

vold (volume daemon): when you insert a CD, it get mounted automatically so that, it uses a daemon called vold

to check the 'vold' daemon
# ps -ef | grep vold

to see all the path of connected devices
# cfgadm -al

disable service:
if service is disable cd will not mount automatically
1. cd /etc/inti.d
2. sh volmgt stop
3. shvolmgt start
(now cd mounted automatically again)

File System:To increase the SWAP capacity by using File System Method


To increase the SWAP capacity by using File System Method

1. select any partition and allocate some space to the partition i.e. the amount of space that has to allocate to increase the swap.
- S4 selected with '100MB' space

2. Edit the file
# vi /etc/vfstab
  /dev/dsk/c0t0d0s1     -     -      swap    -    no
  /dev/dsk/c0t0d0s4     -     -      swap    1    yes  

:wq!

now still 1.2Gb only we need to update some commands

# swap -l
(only one file S1)

# df -h
 (swap 1.2G)

# /sbin/swapadd
# swap -l 
(now two files)
# df -h
1.3G

to delete swap:
# swap -d /dev/dsk/c0t0d0s4
# swap -l
# df -h
now vi /etc/vfstab and remove the entry of s4

note: recommended is file method.. because only file created thats it.
- in FS method whole slice S4, we need to allocate memory it is difficult and wastage.

File Method: Increase the SWAP capacity by using file method


now i want to increase swap 1.2G to 1.3G:

to see the swap location / status
    # swap -l                  // location
    s1
    # swap -s                 // status

1. to increase the SWAP capacity by using File Method
   1. # mkfile 100m /usr/swapfile
   2. # swap -a /usr/swapfile

now see the locaton;
# swap -l                      //now there are two files s1 + swapfile
s1
swapfile

# df -h (100mb added)
now it is 1.3G
swap 1.3G

Note:  if you reboot it again, it will be 1.2 Gb(default) only. because it is temporary. to make it permanent we need to write a script

- when you create a file to increase file capacity it is only temporary but not permanent.
 in order to make it permanent, we need to create a run control script for the default run level.

to permanent the swap file:
# cd /etc/rc2.d
# vi S100 swapfile
  mkfile   100m   /usr/swapfile
  swap   -a   /usr/swapfile                               (:wq! = save & exit)

# pwd
/etc/rc2.d
# ls
S100                                    // every time when you execture S100 file execute

To delete the swap file:
swap -d /usr/swapfile
# rm  /usr/swapfile
# df -h   (now it will be swap 1.2G)
# swap -l
only one file s1

SWAP Management

Swap Management: SWAP which is also called as virtual memory (or) PAGE file
- which is created by taking some memory from hard disk
- the SWAP comes into existence when the physical memory is fully busy. that is it acts as a physical memory for a instance of a time, when physical memory is fully busy.
- the SWAP capacity by default 1.5 times of  a RAM. but we can increase it to double the size of a RAM.
- if we increase more than double it will not take, it will work only double.

We can increase the SWAP memory by two methods
1. File
2. Creating a dedicated SWAP partition (File System)

to see the physical memory:
# prtconf  |grep "Mem"
#df -F ufs
#df -h
swap 1.2G (now)

now i want to increase swap 1.2G to 1.3G:
two methods
1. file method
2. file system method


to see the swap location / status
    # swap -l                  // location
    s1
    # swap -s                 // status

1. to increase the SWAP capacity by using File Method
   1. # mkfile 100m /usr/swapfile
   2. # swap -a /usr/swapfile

now see the locaton;
# swap -l                      //now there are two files s1 + swapfile
s1
swapfile

# df -h (100mb added)
now it is 1.3G
swap 1.3G

Note:  if you reboot it again, it will be 1.2 Gb(default) only. because it is temporary. to make it permanent we need to write a script

- when you create a file to increase file capacity it is only temporary but not permanent.
 in order to make it permanent, we need to create a run control script for the default run level.

to permanent the swap file:
# cd /etc/rc2.d
# vi S100 swapfile
  mkfile   100m   /usr/swapfile
  swap   -a   /usr/swapfile                               (:wq! = save & exit)

# pwd
/etc/rc2.d
# ls
S100                                    // every time when you execture S100 file execute

To delete the swap file:
# swap -d /usr/swapfile
# rm  /usr/swapfile
# df -h   (now it will be swap 1.2G)
# swap -l
only one file s1


2. To increase the SWAP capacity by using File System Method


1. select any partition and allocate some space to the partition i.e. the amount of space that has to allocate to increase the swap.
- S4 selected with '100MB' space

2. Edit the file
# vi /etc/vfstab
  /dev/dsk/c0t0d0s1     -     -      swap    -    no
  /dev/dsk/c0t0d0s4     -     -      swap    1    yes

:wq!

now still 1.2Gb only we need to update some commands

# swap -l
(only one file S1)

# df -h
 (swap 1.2G)

# /sbin/swapadd
# swap -l
(now two files)
# df -h
1.3G

to delete swap:
# swap -d /dev/dsk/c0t0d0s4
# swap -l
# df -h
now vi /etc/vfstab and remove the entry of s4

note: recommended is file method.. because only file created thats it.
- in FS method whole slice S4, we need to allocate memory it is difficult and wastage.










Patch Administration

Patch:
A patch is a collection of specified package which especially used to upgrade the system and establish a communication link between the existing application & the new application.
- we can download the patch from the internet and it will be always in 'zip' format.
- we need to unzip it and extract it.
- every patch comes along with batch ID
ex: 118893 -14          //it is called batch id, 118893 is a patch id and 14 is a version
- where the 1st part of the batch id is patch id & 2nd part is version
- by default, if want to add a patch, the patch should be kept at the location called
   /var/spool/patch
- but the patch directory doesn't exist, we need to create it
  # cd /var/spool

1. # cd /var/spool
2. # mkdir patch
3. # cd patch
4. insert patch cd
   # df -h                  // it displays the cd mounted
  # cd /cdrom/cdrom0
  # ls
  # cd patch_
  # ls
  (118833_3.zip, 119963_1.zip)            // 3- 3 files, 1-1 file
 
to copy the patch from 'cdrom' to required location
#cp -r 119963_1.zip /var/spool/patch

check:
 # cd /var/spool/patch
 # ls
  119963_1.zip              (it should be there)

unzip the file:
 # unzip 119963_1.zip
 # ls
   119963-14               119963-1.zip

Add a patch:
1. #pwd
   /var/spool/patch           (go to the file where the patch file)

2. # cd 119963-14
3. # pwd
   /var/spool/patch/119963-14
4. # patchadd /var/spool/patch/119963-14

to remove the path:  
# patchrm 119963-14
 



Spooling


Spooling: Storing something temporarily in a buffer is called spooling
when we spool a package we can add the package directly with out OS cd
SPOOL: simultaneous peripheral operational online.
1. to spool a package:
  # pkgadd -d /cdrom/cdrom0/s0/Solaris_10/Product -s spool SUNWzsh

2. all the spooled packages are stored under
   /var/spool/pkg
# cd /var/spool/pkg
# ls
SUNWsh
# pwd
 /var/spool/pkg
# cd
# eject cdrom

now delete zsh:
1. remove zsh
# pkgrm SUNWzsh

2. to get back the package from spool
# pkgadd SUNWzsh

Note: 
while adding a package the '-d' option is used, to add a package from removal devices
there is no need of '-d' option to add a package from spool.

Package Administration

Package Administration: how to remove patches/packages are called package administration.
1. Package: A group of files or collection of files are called package.
2. Cluster: A group of packages are called cluster.
3. Patch: Specified no of or specified group of packages are called path
4. Software configuration group: A collection of clusters

Software Configuration groups:
Software config groups                       Software config clusters
1. Entire distribution with OEM                     SUNWXCall (online support)
2. Entire distribution with out OEM                SUNWXCall (no online support)
3. Developer System Support                        SUNWCprog
4. End User Support                                      SUNWCsu
5. Core System Support                                 SUNWCreq
6. Reduced networking support                      SUNWCnreq

OEM: online equipment manage
the software group with OEM will be having online support, where as software group without OEM will not be having online support
Note: By default there will not be any difference between with & without OEM, that is initialization wise, working wise, the amount of space that it takes for installation is almost same.

Note: Every cluster is identified with 'SUNW' (Stanford University of Networking)

1. to check the cluster which presently installed in a system:
# cat /var/sadm/system/admin/CLUSTER

2. to check the installed packages in the harddisk
# pkginfo

3. to know the word count of no. of installed packages in a system.
# pkginfo |wc -l

4. to check the specified installed package
# pkginfo SUNWzsh

5. to remove a package
# pkgrm SUNWzsh

6. to add a package again to system:
               1. insert the OS cd
               2. to view the packages under CDROM
                   bash-3.00# pkginfo -d /cdrom/cdrom0/s0/Solaris_10/Product |more
                   bash-3.00# pkginfo -d /cdrom/cdrom0/s0/Solaris_10/Product SUNWzsh

               3. check the package
                  #pkginfo SUNWzsh

7. to view files & directories which are installed along with the package:
    # pkgchk -v SUNWzsh

8. to check the consistency of the package:
    # pkgchk SUNWzsh

Note: when you add a package by default one is updated automatically
# cat /var/sadm/install/contents

note: every time we cant insert OS CD and installing, so store in buffer called spooling.

Spooling: Storing something temporarily in a buffer is called spooling
when we spool a package we can add the package directly with out OS cd
SPOOL: simultaneous peripheral operational online.
1. to spool a package:
  # pkgadd -d /cdrom/cdrom0/s0/Solaris_10/Product -s spool SUNWzsh

2. all the spooled packages are stored under
   /var/spool/pkg
# cd /var/spool/pkg
# ls
SUNWsh
# pwd
 /var/spool/pkg
# cd
# eject cdrom

now delete zsh:
1. remove zsh
# pkgrm SUNWzsh

2. to get back the package from spool
# pkgadd SUNWzsh

Note:
while adding a package the '-d' option is used, to add a package from removal devices
there is no need of '-d' option to add a package from spool.




Wednesday 11 May 2011

SMF

SMF (Service Management Facility):
the services under control of svcs are called SMF service, it is under control of user.

SMF services can be different state
1. Degraded: The service is enabe but it is running at a limited capacity
2. Disable: The service which is enabled but not running
3. Maintainace: The service which has encountered with a error that has to be rectified by the admin
4. Offline: the service which is enabled but its not running or not available to run
5. Online: The service which is enabled and has successfully started.
6. Uninitialized: The intial state of the service before the configuration is 'uninitialized'.

to view all the services:
#svcs -a: it will show the disable services also.

Note:
1. In SMF services all the specified services are divided into different categories and named them as 'milstoned'.
we have different mile stones like network, system, application, multi user mode, single user mode, etc.

2. All the services under SMF are identified with "FMRI" (Fault Management Resource Identifier)

to check the status of the service:
# svcs -a|grep telnet

to disable a service:
# svcadm disable telnet

to enable the service:
#svcadm enable svc:/network/telnet: default

RUN LEVELS

There are 8 different kinds of run levels exist in Solaris

0 - Dead mode (power off)
s - Single user mode (maintainance mode)
1 - Single user mode
2 - Multi user mode
3 - Multi user mode
4 - Reserved
5 - Power off
6 - Reboot

1. init s : It is called as single user mode also known as maintainance mode. When you bring the system to this level, all the terminal logins and use logins are disconnected, and all the filesystems are unmounted except root (/) & root user (/user).

2. init 1 : It is same as 'init s' except 'terminal login enable'. It is a single usermode in which 'terminal login' are allowed and 'user logins' are disconnected and new logins are not allowed and all the filesystems are unmounted except root(/), root user(/user).

3. init 2: It is a multi user mode in which all the user logins, & terminal logins are allowed. and all the file systems in mounted state but NFS services will not be working.

4. init 3: (Default run level): It is a multiuser mode in which all allow, NFS also. All the user logins & terminal logins are allowed. All the file system in mounted state along with NFS.

5. init 4: It is reserved for future purpose

6. init 5:  power off

7. init 6:  reboot

note: For all this run levels the respective services will be stored indirectly in /etc/rcn.d
ex: /etc/rc1.d               // all init 1, rc- run control script

Types of services:
1. legacy run services (rc) (system)
2. SMF(service management facility) services (online) (svc) (user)
1. The services which are under control of  'rc' scripts are called legacy run services. which is not maintained by SMF. it is under control of system
2. SMF: the services under control of SVCS are called SMF service. it is under control of user

# svcs    // it will show all services
ex:
# cd /etc/rc1.d (display some services of runlevel 1)               // k- kill mode (many)
 #ls                                                                                       // s- start mode (1)
# cd /etc/rc2.d (display some services of runlevel 2)

Note: for every run level we have respective services which are place under /etc/rcn.d


few important commands

1. # last: It will give all the information regarding booting, when you shutdown, logged in with time.
2. /etc/ntmp: This file contains record of current logged in user
3. /var/adm/wtmp: it contain record of all logins & log outs for each user
4. /var/adm/lastlog: This file contains the list of the last login records for each user.

Sunday 1 May 2011

Security Administration

Security Administration:

1. /etc/default/passwd
2. /etc/default/login
3. /etc/default/su
4. /etc/nologin
5. /var/adm/loginlog
6. /etc/skel


to break a password

How to break a pass word
1. Insert the Solaris OS CD
2. Ok setenv boot-device cdrom
3. Ok boot cdrom -s                    // single user (or) maintainance mode
4. # TERM = ansi
    # export TERM                        // RAM to kernel
    # mkdir /tmp/root/abc
    # mount /dev/dsk/c0t0d0s0   /tmp/root/abc
    # vi /tmp/root/abc/etc/shadow
   /root/xxxxxxxxxxxxxx/pwd
 now remove the 13 encoded characters, save & exit
now restart
# init 6
# ok setenv boot-device disk
# ok boot disk









assign a password to a user

# useradd -d /export/home/sita -m sita
# passwd sita
new password: sun
re-enter new password: sun

note:
1. when you assign a password to file by default one file updated  /etc/shadow
to dispaly this file
ex:
# cat /etc/shadow
sita:5znvn4yaDbzck:15065

2. the password file in shadow file is in encrypted format whose length is 13 characters.

Password status:
the user password in 3 different states
1. LK (lock mode)
2. PS (password status mode)
3. NO (no password mode)

check the status of the password:
# passwd -s sita
sita PS                               // PS - password status

Delete the password:
# passwd -d sita               // d- delete


if you check the status now it will be NP(no pwd)
# passwd -s sita
sita NP


if password is not assigned defaultly it takes LK(lock)
# passwd -s jack 
jack LK

to lock password:
# passwd -l sita

to unlock password:
# passwd -u sita

Group & user modification:
1. to modify a group ID:
# groupmod -g <new gid> <groupname>

2. to modify a group name:
# groupmod -n <new name> <old name>

3. to delete a group
# groupdel <groupname>

4. to modify user Id
# usermod -u <uid> <user name>

5. to change the primary group name
# usermod -g <group name> <user name>

6. to change the secondary group name
# usermod -G <group name> <user name>

7. to change user name
# usermod -l <new name> <old name>

8. to delete the user:
# userdel <user name>

9. to delete user name along with id:
# userdel -r <username>

how to create a user

Types of User:
1. Normal
2. Admin

User contains username (for admin understanding) & user ID(for kernel understanding)
Syntax to create a user:
#useradd -u<uid> -g<gid> -G<gid> -d /export/home/<home dir> -m -s /bin/kshell <username>

ex: #useradd -u 1166 -g gram -G gramsci -d /export/home/jack -m -s /bin/sh jack
64 blocks

specification:
1. -u: used to specify user ID
2. -g: primary group ID
3. -G: secondary group ID
4. -d: to specify the default home directory
5. -m: to create a dir when directory not present
6. -s: to specify shell

minimum fields required to create a normal user:
ex;
# useradd -d /export/home/shiva -m shiva
# cat /etc/passwd

note:
1. when you create a user by default one file is gets updated automatically
/etc/passwd
2. when you create a user without specifying the primary group, by default it will be linked to default group that is "others". it is a system defined group, and whose gid=1 always.
3. If we do not specify the 'uid' while creating a user, it will take the increament value of the highest uid and if you don't specify a shell it will take defaultly /bin/sh.

ex:
#useradd -d /export/home/sita -m sita
64 blocks (32 kb)
1block = 512 bytes
2block= 1kB

#cat /etc/passwd
jack:x: ->'x' indicate password but it will not store password