Wednesday, September 24, 2008

Use of /etc/mail/aliases

We will see how to use /etc/mail/aliases efefctively ?

First find domainname of the server.

# domainname
xyz.com

Now in this case domainname of the server is xyz.com.

1. Forwarding mail to mail account rather than user. Add following lines in /etc/mail/aliases

user1: user.surname@domainname.com

Now you can send mail to user1@xyz.com and mail will distributed to user.surname@domainname.com

2. If no users are in To: field then ignore it. Add following lines in /etc/mail/aliases

undisclosed-recipients: /dev/null

3. Add following lines in /etc/mail/aliases for support

support: support@domainname.com

4. Forwarding mails to group of people

4.1 Create group called wishlist and add in /etc/mail/aliases

wishlist: :include:/admin/etc/wishlist.mail

4.2 Create file whose content looks like

# more /admin/etc/wishlist.mail

user1@domainname.com
user2@domainname.com
user3@domainname.com

Now you can send mail to wishlist@xyz.com and mail will distributed to user1@domainname.com, user2@domainname.com ,user3@domainname.com

Now you can send mails and you will receive it on new mail id. If you use effectviely your administration and support will much easier.

Script for Oracle export backup

Lot of time we need to have export backup of Oracle. Follwoing script will help to take export backup. You need to just change variable of your environment.I assumed that username password id system/manager

----------------------------------------------------------------------------------
#!/bin/sh

# Name : Oracle Export Backup
# Writer : Mahendra Rajgude
# Date : 23 Oct 2007
# Version : 0.1
# Pupose : This script is written to take oracle export backup


# Exporting environmental variable. This will specific to server.

HOSTNAME=`hostname`
ORACLE_SID=ngs
ORAWEB_ADMIN=/u01/app/oracle/admin
ORAWEB_BASE=/u01/app/oracle
ORAWEB_HOME=/u01/app/oracle/products/9.2.0
ORACLE_BASE=/u01/app/oracle
ORACLE_TERM=vt100
ORACLE_HOME=/u01/app/oracle/products/9.2.0
ORACLE_PATH=/u01/app/oracle/products/9.2.0/rdbms/admin:/u01/app/oracle/products/9.2.0/sqlplus/admin:/u01/app/oracle/common/sql
BACKUP_DIR=/oraclebackup

export ORACLE_SID ORAWEB_ADMIN ORAWEB_BASE ORAWEB_HOME ORACLE_BASE ORACLE_TERM ORACLE_HOME ORACLE_PATH BACKUP_DIR HOSTNAME

# Export DATE format to add extention to backup file.

DATE=`date '+%d'`

#echo Logfile{$DATE}

# Remove any previous backup file

rm ${BACKUP_DIR}/${HOSTNAME}_full.dmp.${DATE}.gz

# Actual backup starts here

${ORACLE_HOME}/bin/exp system/manager full=y file=${BACKUP_DIR}/${HOSTNAME}_full.dmp.${DATE} statistics=none log=${BACKUP_DIR}/${HOSTNAME}_full.log.${DATE} buffer=2048000 compress=y consistent=y


# Compression done here to reduce the size of backup


/usr/bin/gzip ${BACKUP_DIR}/${HOSTNAME}_full.dmp.${DATE}

# Removing uncompressed file..

rm ${BACKUP_DIR}/${HOSTNAME}_full.dmp.${DATE}

#####################################################################################

# Change History

# V 1.0 Dated 23 Oct 2007 checked working fine.

Monday, September 22, 2008

Good quotes about Heart



















If GOD wants to speak to you, he will speak to through your heart. Heart then tries to tell you. You should listen to your heart if wants GOD's message for you. Mahendra Rajgude



A memory is a photograph taken by the heart
to make a special moment last forever....Unknown.

Let your heart guide you. It whispers,
so listen closely....Land Before Time.

You may hold my hand for a while,
but you hold my heart forever....Unknown.

As the ocean is never full of water,
so is the heart never full of love....Unknown.

What the heart gives away is never gone...
It is kept in the hearts of others....Robin St. John.

Love is blind only to the eyes.
The heart sees everything clearly....Unknown.

A person's actions depict the heart,
not the words they say....Brian Lee.

To get a woman's heart a man must first use his own....Unknown.

Sometimes we make love with our eyes. Sometimes we
love with our hands...Sometimes with our bodies.
Always we make love with our hearts....Unknown.

It is not the size of a man but the size of
his heart that matters....Evander Holyfield.

Follow your heart, but be quiet for a while
first. Ask questions, then feel the answer.
Learn to trust your heart....Unknown.

Precious gifts of friendship...knowing the heart of
another, sharing one's heart with another....Unknown
.

Never close your lips to those whom
you have opened your heart....Unknown.

It is only with the heart that one
can see rightly; what is essential is
invisible to the eye....Antoine De Saint-Exupery.

For it was not into my ear you whispered
but into my heart, it was not my lips
you kissed, but my soul....Judy Garland.

The best and most beautiful things in this
world cannot be seen or even heard, but must
be felt with the heart....Helen Keller.


A friend is one to whom one can pour out all the
contents of one's heart, chaff and grain together,
knowing that the gentlest of hands will take and
sift it, keeping what is worth keeping, and, with the
breath of kindness, blow the rest away....Arabian Proverb.

If you find it in your heart to care for somebody
else, you will have succeeded....Maya Angelou.

t is the heart that makes a man rich.
He is rich according to what he is,
not according to what he has....Henry Ward Beecher.

Great is the human who has not lost his childlike heart....Mencius.

Find the seed at the bottom of your heart
and bring forth a flower....Shigenori Kameoka.

Everyone should carefully observe which way
his heart draws him, and then choose that
way with all his strength....Hasidic Saying.

The heart already knows
What the mind can only dream of.
Trust your heart....Unknown.

You can admire a woman for her beauty, but you
can only respect a woman for her heart....Unknown.


Friendship is like a rainbow between two hearts....Unknown.

Follow your mind and be smart,
follow your heart and be happy....Unknown.

Wednesday, September 17, 2008

How to set password-less ssh login ?

















( The image above is from Rohit Sharma's stock photography website http://opticverse.com. Thanks to Rohit for allowing me to publish.)

It is important to note that, since the SSH protocol is a highly secure one, it does not accept just the traditonal .rhosts on the users login for accepting a remote connection without password verification.

The implementation of SSH1 and SS2 are slightly diferent, and from OpenSSH to SSH2 vary too. Since most of the Linux machines are running OpenSSH2, we will describe here how to make the "trick" for avoiding a password everytime when running openssh2 on both client and server.
For detailed information about the class of key verification and encription that ssh uses, see the ssh and related man pages or online documentation at http://www.openssh.com/manual.html

The basic idea is, however, that in the cryptosystem that ssh uses (RSA or/and DSA) the encription and decription are done using diferent keys
Basically, what the user (client) needs is to generate a public/private key pair. The server will know the public key, but only the client will know the private key.
When the client connects to the server, it tells its own public key. If this key is allowed (if it is between the know public keys list on the server), the server will send a randomic number to the client. This encripted number can only be decripted if the appropiate decription key is used, and this decription key is the client's private one. The client then uses then its own private key and decript the number. If this is done correctly, the server will grant the acces with no more questions. As you can see the system is safe, because the client never tells anybody about its private key; and this key cannot be inferred using the public one.

What must be done, then , is to generate a public/private key pair, and copy the public part into the appropiate place on the server side.
For doing this, on the user's home directory, on the client machine, type

local> ssh-keygen -t dsa -f .ssh/id_dsa

-t tells the type of encription
-f tells where to store the public/private key pairs. In this case, the .ssh directory on home is being used

A password will be asked; leave this part blank, just pressing
Now, go the .ssh directory, and you will find two new files: id_dsa and id_dsa.pub. The last one is the public part. Now, copy the public key to the server machine

local> cd .ssh
local> scp id_dsa.pub user@remote:~/.ssh/id_dsa.pub

Of course, this time you will need to enter the password.
Now, login into the server machine and go to the .ssh directory on the server side

local> ssh user@remote
remote> cd .ssh

Now, add the client's public key to the know public keys on the server

remote> cat id_dsa.pub >> authorized_keys2
remote> chmod 640 authorized_keys2
remote> rm id_dsa.pub
remote> exit

and that's all.

Next time you log into the remote server, no password will be asked.

Note that this sytem will work while none of the machines change its IP address and for the specific user, so it is still safe.

-------------------------------------------------------------------------------------

sala:~$ ssh-keygen -t dsa -f .ssh/id_dsa
Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in .ssh/id_dsa.
Your public key has been saved in .ssh/id_dsa.pub.
The key fingerprint is:
26:10:4b:b5:ae:c0:89:5f:d5:d1:ce:e9:5c:49:a3:63 rajgudm@sala
sala:~$ cd .ssh
sala:~/.ssh$ ls
id_dsa id_dsa.pub known_hosts


nandi:~/.ssh$ cat id_dsa.pub >> authorized_keys2
nandi:~/.ssh$ chmod 640 authorized_keys2
nandi:~/.ssh$ rm id_dsa.pub
nandi:~/.ssh$ exit
logout
Connection to nandi closed.
sala:~/.ssh$ hostname
sala

And just check if it is working ... It should work ...

sala:~/.ssh$ ssh nandi

Otherwise now find the reason for not working. Nothing fully readymade in this world. :)

Sunday, September 14, 2008

How to recover root password of Sun Server ?

















Step−by−Step Procedure



If the system is not halted, then halt the system by pressing Stop−A. This will bring you to the OK prompt.

Place the installation CD−ROM in the CD−ROM drive. Boot the system to single user mode using the CD−ROM drive.

Type : boot cdrom −s ======> If you are booting from -ROM
Type : boot net -s ======> If you are booting from Network Jump Start Server.

( For u need to server configure. That procedure is not included here)


It may take awhile, but you will automatically be logged in as root in single user mode running the OS from the CD−ROM.

1. If you had to force halt the system, by pressing Stop−A for instance, then the partitions on the hard disk will not be marked as being shutdown cleanly. If this happens, run fsck on the root partition. It is used to check and repair the file system. In this case it won't ask for the root password as it is in single
user mode. Type: fsck −y /dev/dsk/c0t3d0s0

2. Now c0t3d0s0 is just the root partition in this example. Verify your boot disk.

4. Remove root's password using your editor and edit /a/etc/shadow. Find root's entry in the file and make the second field null. Colons are the field delimeters. So your entry, after changes, should look something like:

root::10565::::::

Various fields will be used if certain parameters have been set for the OS.

5. Boot to single user mode using the hard disk.

Type: reboot −− −s

Note: That is, reboot space hyphen hyphen space hyphen s.

6.You can log in as root without a password and set root's password using the passwd command.

7. Exit single user mode and let the system continue booting to multi−user mode.

Wednesday, September 10, 2008

How extend soft partition?

Objective :

1. To extend soft partition by keeping data intact.
2. To extend meta partition by keeping data intact

Audience :
Audience of the document should be well aware of Solaris commands. They should have proper knowledge of SVM concept and commands. I am assuming that the users are aware of impact of the commands and for safer side , I recommends to take backup before starting exercise.

Setup :

1. Slice used to meta database c0t0d0s7 and size is 100 Mb
2. c0t0d0s7 is 2.7 GB
3. c0t9d0s0 10 Gb

Steps :

1. Create database

bash-3.00# metadb -f -a -c 3 c0t0d0s7
bash-3.00# metadb
flags first blk block count
a u 16 8192 /dev/dsk/c0t0d0s7
a u 8208 8192 /dev/dsk/c0t0d0s7
a u 16400 8192 /dev/dsk/c0t0d0s7

2. Create meta device d10

bash-3.00# metainit d10 1 1 c0t0d0s4

d10: Concat/Stripe is setup
bash-3.00# metastat
d10: Concat/Stripe
Size: 3986352 blocks (1.9 GB)
Stripe 0:
Device Start Block Dbase Reloc
c0t0d0s4 0 No Yes

Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SFUJITSU_MAG3182L_SUN18G_01585615____

3. Create new soft partition

bash-3.00# metainit d31 -p d10 1g
d31: Soft Partition is setup
bash-3.00# metastat
d31: Soft Partition
Device: d10
State: Okay
Size: 2097152 blocks (1.0 GB)
Extent Start Block Block count
0 32 2097152

d10: Concat/Stripe
Size: 3986352 blocks (1.9 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s4 0 No Okay Yes

Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SFUJITSU_MAG3182L_SUN18G_01585615____

4. Format the newly created soft partition and mount it

# newfs /dev/md/dsk/d31

newfs: construct a new file system /dev/md/rdsk/d31: (y/n)? yes
Warning: 4400 sector(s) in last cylinder unallocated
/dev/md/rdsk/d31: 2097152 sectors in 446 cylinders of 19 tracks, 248 secto
rs
1024.0MB in 28 cyl groups (16 c/g, 36.81MB/g, 17664 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 75680, 151328, 226976, 302624, 378272, 453920, 529568, 605216, 680864,
1361696, 1437344, 1512992, 1588640, 1664288, 1739936, 1815584, 1891232,
1966880, 2042528

bash-3.00# mkdir /test1
bash-3.00# mount /dev/md/dsk/d32 /test1

bash-3.00# df –h /test
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d31 963M 1.0M 904M 1% /test

5. Addition of more space in d10

bash-3.00# metattach d10 c0t9d0s0
d10: component is attached

bash-3.00# metastat
d32: Soft Partition
Device: d10
State: Okay
Size: 1024000 blocks (500 MB)
Extent Start Block Block count
0 2097216 1024000

d10: Concat/Stripe
Size: 39533680 blocks (18 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s4 0 No Okay Yes
Stripe 1:
Device Start Block Dbase State Reloc Hot Spare
c0t9d0s0 5080 No Okay Yes

d31: Soft Partition
Device: d10
State: Okay
Size: 2097152 blocks (1.0 GB)
Extent Start Block Block count
0 32 2097152

Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SFUJITSU_MAG3182L_SUN18G_01585615____
c0t9d0 Yes id1,sd@x002037fffebcf385


6. Copy some data make partition full so that we can test it late for extension.

bash-3.00# df -h /test
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d31 963M 960M 0K 100% /test


7. Add 2 Gb space in partition d31

bash-3.00# metattach d31 2g
d31: Soft Partition has been grown

bash-3.00# df -h /test
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d31 963M 960M 0K 100% /test

( Please note partition size is still not grown.)

8. Now final step that will make partition grow without destroying data.

bash-3.00# growfs -M /test /dev/md/rdsk/d31
Warning: 3776 sector(s) in last cylinder unallocated
/dev/md/rdsk/d31: 6291456 sectors in 1336 cylinders of 19 tracks, 248 sectors
3072.0MB in 84 cyl groups (16 c/g, 36.81MB/g, 17664 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 75680, 151328, 226976, 302624, 378272, 453920, 529568, 605216, 680864,
5581600, 5657248, 5732896, 5808544, 5884192, 5959840, 6035488, 6111136,
6186784, 6262432

bash-3.00# df -h
Filesystem size used avail capacity Mounted on

/dev/md/dsk/d31 2.8G 962M 1.8G 34% /test

That’s it.

Wednesday, September 3, 2008

Animal Sketches

On one fine Saturday while in UK around Aug 2008 , I was very bored. I took pen ,paper and started drawing animal faces. In the first attempt , I think I made it. It is definately not best but surely not bad also.



Life and relationship


“Life is all about hit & misses".


The same is true for relationships. Some time it works out, Sometimes not.
It hurts & hurts terribly when expectations are belied, when emotions are trampled & you feel ignored & cheated.
The only way to make a relationship work is determination to ensure it works. However Fear of getting hurt can put you off the relationship.
I need a relationship in which I don’t have to keep explaining myself. I'm searching for that relationship in which I can enjoy freedom of trust.
I need a relationship in which I won’t be held up against myself. I have my strengths & I have my weaknesses.
The search is for that one relationship in which my lesser side wont be provoked & instigated constantly.
I want someone who will always relate to my better side.
I want a relationship in which my positives will always be brought to the fore.
I need a relationship in which my today is not viewed with the mistakes I made yesterday.
I need a relationship where tomorrow’s misery isn’t already confirmed, for the mistake i've made today.
As a human I'm bound to err occasionally. I want someone who won’t maintain a database of my mistakes.
The search is for that one relationship where yesterday's fight doesn't intrude into today's intimacy, where yesterday's argument doesn't halt today's communication.
I need a relationship in which it isn't me who has to take initiative all the time. I need a relationship where I can afford to be transparent.
I need a relationship in which I don’t have to alter my likes & dislikes in order to gain & retain the relationship. I need a relationship in which my self image is not scratched.I need a relationship in which I'm not asked to be anyone other that who I am.. what I am. I need a relationship in which I feel completely myself.
I need that one relationship in which I feel as though I am once again in my mother's womb. A relationship in which my heart always feels... just born.

If you already have one such relationship.. please go down on your knees in gratitude, for there cannot be greater gift from life. Such a relationship is life's greatest gift.

(This article is not written by me. I like it so I posted here. Thanks to genius who written this.)