Wednesday, May 12, 2010

Colorize unix shell prompt

Color Prompts

BASH shell:
alias ll='/opt/sfw/bin/ls -althp --color=auto'


alias toolbox='toolbox-MSC_R-14 &'
alias goplex='cd /home/xviengu/workspace/doPLEX/'
alias goperl='cd /home/xviengu/workspace/doPERL/'
alias gos37='ssh'
alias gos74='ssh'

alias pm=''
alias pb=''
alias csrv=''
alias cpf=''

#alias ana=''
#alias gen=''
#alias com=''
#alias pb=''

if [ $CLEARCASE_ROOT ]; then
    export PS1='\e[0;31m[\u@\e[1;32m\h \e[0;36m`basename $CLEARCASE_ROOT` \e[0;35m${PWD#${PWD%/*/*/*}/}]\\$ \e[m';
    export PS1='\e[0;31m[\u@\e[1;32m\h \e[0;35m${PWD#${PWD%/*/*/*}/}]\\$ \e[m';


alias vim='/home/xviengu/bin/vim'
alias ctags='/home/xviengu/bin/ctags'
alias cscope='/home/xviengu/bin/cscope'


export CSCOPE_DB

export VPATH

Tuesday, May 11, 2010

Monday, May 10, 2010

Autologin with ssh key

Login auto
./instkey.bash dekt1 xviengu
ssh dekt1

SSH Without a Password

The following steps can be used to ssh from one system to another without specifying a password.


  • The system from which the ssh session is started via the ssh command is the client.
  • The system that the ssh session connects to is the server.
  • These steps seem to work on systems running OpenSSH.
  • The steps assume that a DSA key is being used. To use a RSA key substitute 'rsa' for 'dsa'.
  • The steps assume that you are using a Bourne-like shell (sh, ksh or bash)
  • Some of this information came from:


  1. On the client run the following commands:
    $ mkdir -p $HOME/.ssh
    $ chmod 0700 $HOME/.ssh
    $ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''
    This should result in two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/ (public key).
  2. Copy $HOME/.ssh/ to the server.
  3. On the server run the following commands:
    $ cat >> $HOME/.ssh/authorized_keys2
    $ chmod 0600 $HOME/.ssh/authorized_keys2
    Depending on the version of OpenSSH the following commands may also be required:
    $ cat >> $HOME/.ssh/authorized_keys
    $ chmod 0600 $HOME/.ssh/authorized_keys
    An alternative is to create a link from authorized_keys2 to authorized_keys:
    $ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys
  4. On the client test the results by ssh'ing to the server:
    $ ssh -i $HOME/.ssh/id_dsa server
  5. (Optional) Add the following $HOME/.ssh/config on the client:
    Host server
             IdentityFile ~/.ssh/id_dsa
    This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time.

Testing environment

How virtualization will improve your code