468x60 Ads

Monday, August 27, 2012

VI Editor Quick Reference


















Mostly use commands:Create new file name perlFile.pl or open existing file named perlFile.pl.

#vi perlFile.pl

press letter "i" in the keybord for write to the file
Write what eve you want...

If you want to delete a character under cursor:  move pointer on top to the letter, press <Esc> and press letter "x".
To delete character before cursor: move pointer  before the letter , press <Esc> and   press letter "X".

To delete a line: move the pointer to anywhere in the line , press <Esc> and press the letter "dd".
Delete everything in the file: Press <Ese> ":1,$d" and press <Enter>


Save the file : Press <Ese> "wq!"  and press <Enter>
Quite without saving :Press <Ese> "q!"  and press <Enter>

Sunday, August 12, 2012

How to change IP and HOST-NAME on a Solaris 10


How to change IP and HOST-NAME on a Solaris 10


In Solaris 10, you must edit the /etc/hosts and the  /etc/inet/ipnodes file (a symbolic link to /etc/inet/hosts file) with VI editor to do necessary changers an entry for IP address and/or hostname.
How to show the hostname of your system:

# hostname
NTU-HQ-EMS
#

How to show the IP details of your network interfaces:

# ifconfig -a
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
igb0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 172.16.0.1 netmask ffffff00 broadcast 172.16.0.255
#

You can change Red (IP) and green(Host name) colour one as your require...

# cat etc/hosts
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
172.16.0.1      NTU-HQ-EMS      loghost
#


# cat /etc/inet/ipnodes
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
172.16.0.1      NTU-HQ-EMS      loghost
#

Once done, restart the Network service using following command:

# svcadm restart network/physical
Or reboot the server for the changes to take effect.

Check your physical network is up and running:
# svcs |grep -i physical
online         Feb_08   svc:/network/physical:default
#

Note:
The /etc/inet/ipnodes file stores both IPv4 and IPv6 addresses.
If you need to change addresses, you must add IPv4 addresses to both the hosts and ipnodes files. You add only IPv6 addresses to the ipnodes file.
Also, ensure that the /etc/netmasks file with the network ID and the netmask.

Sunday, August 5, 2012

How to reset root password in Solaris server(SPARC)


Let we think our Solaris server password is lost:
There is only way to access to server again is resetting the password.
For that we have to have physical access to the server. (network access/CD or DVR Rom)
Boot the server with a Solaris CD/DVD or a net boot with a JumpStart server from the OBP OK prompt.
OK boot cdrom -s
or
OK boot net –s

This will boot the server from the DVD or Jumpstart server and launch a single user mode (No Password).
Mount the root file system (eg: /dev/dsk/c0t0d0s0 here) onto /dvd
# mount /dev/dsk/c0t0d0s0 /dvd

/dvd is a temporary mount point that is only available when you boot from DVD or a JumpStart server.
In here root file system is mounted into  /dvd. All you need to do is to edit the shadow file and remove the encrypted password for root.
Now you have to edit shadow file to remove existing root  password (password is in encrypted).
# vi /dvd/etc/shadow

root:v.ncDEpjCColQ:15498::::::
daemon:NP:6445::::::
bin:NP:6445::::::
sys:NP:6445::::::
adm:NP:6445::::::
lp:NP:6445::::::
uucp:NP:6445::::::
svctag:*LK*:6445::::::
nobody:*LK*:6445::::::
noaccess:*LK*:6445::::::
nobody4:*LK*:6445::::::
nms:WYRY9Kdk/KJvg:15383::::::
daraka:bweoCRvEGLgcQ:15555::::::

remove everything in between first “:” and second “:” ,save and quit with following command .:wq!
(now it’s looks like:  root::15498::::::)

Now, exit from the mounted file system (/dvd), unmount the root file system and reboot the system.
# cd /
# umount /dvd
# init s
Now we can login to root without password. Change password once you login.
# passwd root
New Password:
Re-enter new Password:
passwd: password successfully changed for root
# reboot
Now you can be able to logon with the new password set for root.