Saturday, February 23, 2013

How to get BASH shell behaviour on AIX server?

As you know BASH shell is having more advantages over any other Unix shells ... some of these features like command history,command editing by using up/down arrow keys, deleting/modifying typos ...

By default AIX uses ksh shell and we will not be able to get all of the above features what bash is having. This post will provide how to achive bash features on AIX machines.

Log in with your User name and you can see .profile under your home directory.

Take backup of your profile.
#cp -p /home//.profile /home//.profile.Date

Add the below lines to your .profile
#vi /home//.profile
set -o emacs
alias __A=`echo "\020"` # up arrow = ^p = back a command
alias __B=`echo "\016"` # down arrow = ^n = down a command
alias __C=`echo "\006"` # right arrow = ^f = forward a character
alias __D=`echo "\002"` # left arrow = ^b = back a character
alias __H=`echo "\001"` # home = ^a = start of line
export EXTENDED_HISTORY=ON


save the file.

Now restart your ssh session, you will be able to do bash operations in AIX machine.

Monday, February 4, 2013

Portmir in AIX and Unix

What is portmir?
Portmir is a very useful command to share your unix session with another remote user.
The portmir utility allows on TTY stream (monitor) to attach another TTY stream (Target).

Requirements:
1. Two Users should login on server.
Limitations:
1. At any point of time Only one mirror session will be active.

How To do/setup Portmir in AIX:
1. Log in to your Unix server from putty. Here my login ID is subha and host is aixtest.
# who
aixtest:/ # who
subha     pts/0       Feb  4 09:07     (X.X.X.X)


2. Issue command tty it will show your terminal details ..
#tty
aixtest:/ # tty
/dev/pts/0


3. Ask your remote user to login on server ... Here my remote user is reddy
#who
aixtest:/home/reddy $ who
reddy         pts/1       Feb  4 09:10     (X.X.X.X)   -------->Here remote terminal marked in RED
subha         pts/0       Feb  4 09:07     (X.X.X.Y)
aixtest:/home/reddy $


Here you can find your remote colleague terminal (my case remote user terminal /dev/pts1)

4. Run portmir command as Below to start sharing ..
#/usr/sbin/portmir -t pts/1
aixtest:/ # /usr/sbin/portmir -t pts/1
portmir: Remote user connected, mirroring active.
aixtest:/home/reddy $
portmir: Remote user connected, mirroring active.
hostname
aixtest
aixtest:/home/reddy $


5. Once your session is over terminate your portmirror with -o option ..

#/usr/sbin/portmir -o
aixtest:/home/reddy $ /usr/sbin/portmir -o
portmir: Mirroring is stopped.


If you're admin user and the other person temporarily requires root access to do
something (and you can't provide sudo's on emergency basis), then you can su -
in the portmir session, allowing the other person to have root access, while you
can see what he/she is doing.