Wednesday, September 30, 2009

KERNEL TRACING/DEBUGGING:

Some commands on Kernel Tracing/Debugging:

# dtrace - Trace and monitor kernel
# lockstat - Monitor locking statistics
# mdb - Debug live and kernel cores
# Hotkernel - What is the kernel doing?

SYSTEM STATISTICS:


Some list of commands for system statistics:



# acctcom - Process accounting
# busstat - Bus hardware counters
# cpustst - CPU hardware counters
# iostat - IO & NFS statistics
# kstat - Display kernel statistics
# mpstat - Processor statistics
# netstat - Network statistics
# nicstat - Enhanced network statistics
# nfsstat - NFS client and server stats
# vmstat - Virtual memory stat
# fstat - File system statistics
# memstat - Memory summary
# filestat - UFS Block layout statistics
# statit - system statistics utility

RBAC - Role Based Access Control

Creating a profile similar to Root's profile:

Here, Profile name: complete
List of commands added: Creating a profile with all root privilidges

Step-1:
Step-1: Adding/Creating a profile by editing the file.
# vi /etc/security/prof_attr
complete:::This is to test the duplication of root profile
1 2

Here,
1 = Name of the profile
2 = Comment about the profile (Optional)



Step-2: Mapping the list of commands to the created profile
# vi /etc/security/exec_attr
complete:suser:cmd:::*:uid=0

Step-3: Mapping the user to the profile
# useradd -m -d /export/home/aita -s /usr/bin/pfsh -P complete aita


Output:

bash-3.00# su - aita
sunfire1# echo $USER
root
sunfire1# roles
No roles
sunfire1# profiles
Web Console Management
All
Basic Solaris User
sunfire1# profiles -l | more

Web Console Management:
/usr/share/webconsole/private/bin/smcwebstart uid=noaccess,
gid=noaccess,
privs=proc_audit
All:
*


Note:
1. The output of the commands
# profiles
# profiles -l
will be similar for the root user.

2. From the above output, we can also observe the change in the shell of the user. Normally for the user the shell is $, but since the all the privilidge is given to the user, the shell is #

Monday, September 7, 2009

Basic Tip

List of commands:

1. How to compress the file?
2. How to zip multiple files & directory?
3. How to gzip a file?
4. How to bzip a file?
5. How to view the format of the files?


OUTPUT:
bash-3.00# compress list

bash-3.00# gzip list1

bash-3.00# bzip2 list2

bash-3.00# zip test.zip new list1 list2 list3
zip warning: name not matched: list1
zip warning: name not matched: list2
adding: new/ (stored 0%)
adding: list3 (deflated 75%)

bash-3.00# tar cvf test.tar list6 list5
a list6 34K
a list5 34K

bash-3.00# ls -lh
total 492
-rw-r--r-- 1 root root 12K Sep 7 03:48 list.Z
-rw-r--r-- 1 root root 8.4K Sep 7 03:48 list1.gz
-rw-r--r-- 1 root root 7.9K Sep 7 03:48 list2.bz2
-rw-r--r-- 1 root root 34K Sep 7 03:48 list3
-rw-r--r-- 1 root root 34K Sep 7 03:48 list4
-rw-r--r-- 1 root root 34K Sep 7 03:48 list5
-rw-r--r-- 1 root root 34K Sep 7 03:49 list6
drwxr-xr-x 2 root root 512 Sep 7 03:49 new
-rw-r--r-- 1 root root 70K Sep 7 03:50 test.tar
-rw-r--r-- 1 root root 8.6K Sep 7 03:49 test.zip

NOTE:
Here
-h = displays the size of file & directory in human readable format (ie, in terms of kb,mb & gb)

bash-3.00# file new
new: directory

bash-3.00# file list5
list5: ascii text

bash-3.00# file list.Z
list.Z: compressed data block compressed 16 bits

bash-3.00# file list1.gz
list1.gz: gzip compressed data - deflate method , original file name

bash-3.00# file list2.bz2
list2.bz2: bzip2 compressed data , block size = 900k

bash-3.00# file test.tar
test.tar: USTAR tar archive

bash-3.00# file test.zip
test.zip: ZIP archive

Thursday, September 3, 2009

To make the processor online/offline:

# psrinfo
- Displays information about processors

Output:
bash-3.00# psrinfo
0 on-line since 08/18/2009 12:43:45
1 on-line since 08/18/2009 12:43:54



# psradm
- Change processor operational status

To bring the processor off-line:
# psradm -f

eg:
# psradm -f 1

Output:
bash-3.00# psradm -f 1
bash-3.00# psrinfo
0 on-line since 08/18/2009 12:43:45
1 off-line since 08/18/2009 16:19:39



To bring back the processor on-line:
# psradm -n

Eg:
# psradm -n 1

To gather the processor staus:
# psrinfo

Output:
bash-3.00# psrinfo
0 on-line since 08/18/2009 12:43:45
1 on-line since 08/18/2009 12:43:54


To bring the processor off-line:
# psradm -f

eg:
# psradm -f 1

Output:
bash-3.00# psradm -f 1
bash-3.00# psrinfo
0 on-line since 08/18/2009 12:43:45
1 off-line since 08/18/2009 16:19:39


To bring back the processor on-line:
# psradm -n

Eg:
# psradm -n 1

Output:
bash-3.00# psradm -n 1
bash-3.00# psrinfo
0 on-line since 08/18/2009 12:43:45
1 on-line since 08/18/2009 16:21:50


Note:
Where
# psradm -n = Bring the specified processor on-line
# psradm -f = Bring the specified processor off-line


Note:
The processor can be brought on-line and offline, whilst the machine is in on state.