Monday, 29 April 2013

PuTTY Connection Manager-Tabbed PuTTY


PuttyCM displays multiple PuTTY sessions in Tabs. In this article, let us review in detail about the 6 powerful features of the PuTTY Connection Manager that will make PuTTY more enjoyable.

Download PuttyCM: PuttyCM website seems to be down  for a while. No problem you can still download from our repository download puttycm.exe that I’ve been using.
PuttyCM is written in C#. You need .NET 2.0. When you install PuttyCM for the first time, you need to specify the location of the PuTTY executable.

Best Features:

Feature 1: Display Multiple PuTTY Sessions in Tab

This is the best feature for which i have  loved it most .You can open multiple putty sessions in one TAB, just like you open multiple text files in  "notepad++"   see below figure for more.

In order to make it run smoothly you need to set few settings as mentioned below. 
Go to Tools -> Options -> Select the check-box “Enable additional timing for PuTTY capture (ms)” -> set the value to   >=500 ms. This will open the PuTTY window inside the TAB as shown below.

Fig: PuTTY sessions in Tabs

Feature 2: Dockable Windows for PuTTY Sessions

Second best feature is apart from displaying multiple PuTTY sessions in Tabs, PuttyCM can also show different PuTTY sessions in panels.This will enables you to view multiple sessions at a time.

In the example below, to move the "DB Server" PuTTY session to the bottom panel, left-click on the 'DB Server' tab and hold the mouse until it displays the panel symbol (which will be like a Plus symbol) in the middle of the screen. Now move the mouse to the bottom of the plus, which will high-light the bottom portion of the screen indicating that the DB Server session will be moved to the bottom panel.

Fig: Select the Panel to dock a PuTTY session
Now, release the mouse, which will move the "DB Server"  to the bottom panel as shown below.

Fig: Selected PuTTY session docked in proper panel
Using the similar technique you can move all the PuTTY sessions to different panels as shown below.

Fig: Multiple PuTTY Sessions docked appropriately

Feature 3: Multi Command Sender (MCS)

This is yet another beautiful feature  but yet more dangerous as well in PuttyCM unless you use it with cautiously. You can run the same command on multiple servers with one shot.This will save a lot of time  specially for system administrators.

Make sure that you running correct command before hitting enter, otherwise it will become a big mess.

In-order to use this feature we need to open dockable windows as specified in feature 2. Then you need to select on which servers you want to run single command just like show in the below figure.

Fig: PuTTYCM Multi Command Sender server selection.

Then you need to run the command which like on the "Command Tab"  just like below and you will see its running in all the server windows you selected. Hurrey ..! that's amazing right.

Fig: PuTTYCM Multi Command Sender "running command on multiple servers"

Feature 4: Encrypted PuTTY Configuration Database

By default, PuTTY session informations are stored in the windows registry, which are not encrypted. If you want to keep the session information (ip-address, session name etc.,) encrypted, you can use the database encryption feature available in the PuttyCM
  • Download the AES encryption library (pcmcrypt.dll) from our repository.
  • Place this file in the PuttyCM program folder. C:\Program Files\PuTTY Connection Manager
  • Restart the PuttyCM
  • Go to Tools menu -> Options -> Database -> under the Encryption section, the available algorithms should display “AES Rinjdael Managed” as shown below, indicating that the encryption library is successfully installed.
Enable PuTTY Encryption
Fig: Enable Encryption
Click on File -> New -> Database and enter the appropriate information as shown below to create a secure PuTTY session database. Follow the best practices to create a strong password while choosing the pass phrase for the secure database.
  • Database Name: putty-secure-sessions
  • Click on Enable database encryption check-box
  • Select “AES Rinjdael Managed 256 bits
  • Enter a strong passphrase for the database.
  • Click on ‘Create database’ to create the database as shown below.
Create Encrypted PuTTY Database
Fig: Create Encrypted PuTTY session database
  • Click on File menu -> save database to save the database to a physical file.
  • Now the ‘putty-secure-sessions’ database will be displayed under the Connection manager as shown below

Fig: PuTTY Connection Manager displaying Encrypted Session database
  • Right mouse-click on the ‘putty-secure-sessions’ database name -> Click on New -> Click on Connection, to create a new secure PuTTY session.

Feature 5: Automatic PuTTY Session Login

Once you’ve created a secure PuTTY session as mentioned above, you can setup automatic login. i.e you can save the uid/pwd for the individual PuTTY session in the secure database. i.e When you double-click on a particular secure PuTTY session, it will login automatically.
From the putty-secure-sessions database, select a particular PuTTY session, right mouse-click and select Configuration, click on the ‘Enable Macro’ check-box as shown below.

Fig: Enable Login Macro For a PuTTY Session
From the same PuTTY session configuration window, click on the ‘Login Macro’ from the left-side menu and enter the uid/pwd as shown below.

Fig: Automatic Login Setup for a PuTTY Session
Now, when you double-click on that particular PuTTY session, it will do the login automatically using the credentials you’ve provided.

Feature 6: PuTTY Session Post-Login Commands

You can also setup post-login command, which will get executed automatically after you login.

The setup of post-login commands is done under the same ‘Login macro’ screen under the ‘Post-login command’ section. Click on ‘Enable post-login commands’ check-box and you can set a total of 5 post login commands as shown below.

Fig: Execute Commands automatically after login

Apart from the above 6 powerful features, PuTTY Connection Manager have the following features: 

  • Ability to select multiple themes
  • Import and Export PuTTY sessions
  • PuttyCM also comes as standalone executable that can be launched directly from an USB thumb drive
  • And finally, PuTTY Connection Manager is a freeware
For PuttyCM Alternatives you can check this article ...PuttyCM_Alternatives


Some questions asked by blog readers regarding Putty Connection Manager.  (PuttyCM.exe)
1) When I minimize PuttyCM window it disappears. I can’t reactivate the window using ALT-TAB too. If I try to start the application again it says ‘Application already started’. How to fix this?
This can be fixed by changing PuttyCM settings. Go to the menu bar, click on Tools and then Options.
Select General from the options in the left side pane. Now in the right side you can see the check button ‘Hide when minimized’. In this case this would have been enabled. Un-selecting this button will solve the problem.

2) Above tip has solved my problem. I am having one more issue now. After I minimize Puttycm windows if I try to reactivate the window by clicking on the Puttycm icon in the taskbar, it does not activate the window sometimes.
This is another known problem. You just need to use ALT-TAB to restore the window. Sometimes it does not open immediately even after pressing ALT-TAB once. Try doing it again and it will work.
3) I created a database and created new connections. But I do not see the connections after reopening puttycm, what happened with the old database I created?
Looks like you did not save the database. After creating a new database and new connections, you might think that all the changes are saved but they are not. You have do explicitly save the database changes by clicking on File from the menu bar and then selecting Save Database.
4) How to encrypt the database file? Storing passwords in plain text could be a security issue?
There is no in-built feature to encrypt database looks like. There is a check button ‘Enable database encryption’ in Database-> Properties but it’s grayed out. May be the feature is not yet implemented.
But you can encrypt the database file using Windows EFS feature if you have a OS edition that supports the feature(XP home does not support EFS). Just right click on the file and Properties -> Advanced. Select the check button Enable encryption to secure data.
5) Where are PuttyCM’s registry keys stored ?
You can find Putty connection manager’s registry keys under the nodeHKEY_CURRENT_USER\Software\ACS\PuTTY Connection Manager
6) How to disable Ctrl-R binding? Ctrl-R is  a shortcut for searching command history in Linux. But doing  Ctrl-R in PuttyCM opens up tab rename window. How to fix this?
Open Tools -> Options -> Hotkeys. Change the shortcut for rename tab to something else. You would be able to search command history now. 
More known issues with PuttyCM:
  • Exporting Putty sessions fails with the error ‘Error during export Putty sessions’.
  • Disabling ‘Show tray icon’ has issue. After restarting PuttyCM it shows ‘unexpected error occurred’ message when you try to create a new connection. PuttyCM does not work and you will have to enable ‘show tray icon’ to use PuttyCM.
  • I have not found a way of changing the background color to something other than black. If any of you know solution to this please let me know.
For PuttyCM Alternatives you can check this article ...PuttyCM_Alternatives

Friday, 26 April 2013

Login Sequence in AIX

How the login takes place in AIX?

You need to download and install putty to connect to the server if the server is remotely available. You need to mention the ip address, port number and connection type (telnet, SSH, rlogin etc) and connect to the server.

Once connected, the black session screen will appear/open up and will ask for user to login (settings available in /etc/security/login.cfg ).

Login sequence:
  1. As the user enters the username and password, system verifies the same from /etc/passwd and/etc/security/passwd file.
  2. If valid, the user is logged into the system else the user is asked to re-enter the username and password on every invalid entry (records a log entry in /etc/security/failedlogin).
  3. Once logged in, the system setup user’s environment. This is available in /etc/environment, /etc/security/environment, /etc/security/user, /etc/security/limits.
  4. It sometimes displays the “Message of the Day” configured by the administrator on login. This is available in /etc/motd? File.
  5. Login shell will appear.
  6. User’s profile (/etc/profile) will be setup and user will be placed in HOME directory.
Now the user can run any commands on the screen.

So the main steps for users to login are:

Login -> /etc/environment -> /etc/profile -> HOME directory

Printer AIX

Commands to give print to a job:
# lp
# lpr: for eg: # lpr –p <printername> <filename> : will print the file to a specific printer.
# qprt
# enq
Each job sent for print has a print job number associated with it.
Commands to check the status of print jobs:
# lpq
# lpstat
# qchk
# enq –A
Commands to cancel the print jobs:
# cancel
# lprm
# qcan
#enq –X
Enqenq -Aenq -X
Advanced Concepts:
Print Subsystem:
There are 5 different types of print subsystem available:
1.       AIX Print Subsystem
2.       Print directly to local printer
3.       System V Print Subsystem
4.       Print directly to remote printer
5.       Info print manager
To show current print subsystem:
# switch.prt –d
To change current print subsystem:
# switch.prt –s AIX
# switch.prt –d AIX
# switch.prt –s System V
# switch.prt –d System V
Printer Workflow:
End user sends a request to print a file using any of the print commands (lp,lpr,qprt,enq) to the print queue.
The request goes to /var/spool/lpd/qdir
A copy of the request goes to the spool directory /var/spool/qdaemon
/qdaemon gets notified of the request in /qdir
/qdaemon checks for availability of the queue in /etc/qconfig
Once queue is ready, /qdaemon updates /var/spool/lpd/stat to start processing the request in the queue
Printer Interface:
There are 3 types of printer interface available:
To enable a queue whose status is Down (only user with admin privileges can run this command):
# enable queuename
To disable a queue whose status is Ready (only user with admin privileges can run this command):
# disable queuename
To move jobs between queues in AIX:
# qmov –m <queuename> -# <jobnumber>

System Resource Control (SRC)

SRC is basically used to control the entire subsystem.
It allows you to start, stop and check status information about various subsystem processes.
SRC lists all the services present in /etc/inittab.
Once the kernel starts all the background services, SRC is activated.
-          Subsystem group
  • Subsystem
    • Subsystem server (subserver)
SRC is basically designed to minimize human intervention.
For a subsystem group:
To list:
# lssrc –g <subsystem group>
To start:
# startsrc –g <subsystem group>
To stop:
# stopsrc –g <subsystem group>
For a subsystem:
To list:
# lssrc –s <subsystem>
To start:
# startsrc –s <subsystem>
To stop:
# stopsrc –s <subsystem>
For a subserver:
To list:
# lssrc –t <subserver>
To start:
# startsrc –t <subserver>
To stop:
# stopsrc –s <subserver>
To refresh:
# refresh will refresh/restart the services. Application need not be restarted for end user.

Network File System (NFS) Concepts

This post will discuss about the concepts involved in network file system (NFS) administration.
Prerequisites for NFS:
  1. NFS daemons should be running on both client as well as server machines.
  2. A file system should always be available on the server that has to be exported.
  3. Exported file system must be mounted on the remote client machine.
NFS daemons are not running by default on new OS installation.
To active the NFSD daemons, following command needs to be run:
# startsrc –s nfsd
To start all daemons:
# startsrc –g nfs
Can also be activated from smit by running this command,
# smit mknfs
Exporting a Directory:
There are 2 ways to export a directory:
  1. Using smit
# smit mknfsexp
It will update /etc/exports file. If the file does not exist, it will be created.
  1. Through command line
End user or admin will create (update) /etc/exports file using,
# vi /etc/exports
If it does not exists, end user will create it and then run the export command,
# exportfs –a
This command will send the information available in /etc/exports file to the kernel.
Other Options available are:
# exportfs –u </dir name>
This will remove the information from /etc/exports file
This can also be done through smit using the following command:
# smit rmnfsexp
It will remove the information from /etc/exports file
To change the data through smit, command used is:
# smit chnfsexp
Will change the information in /etc/exports file
To verify from the remote server:
# showmount –e <localhost> OR <ip address>
To check/verify from the client side:
Using smit,
# smit mknfsmnt
Using command line,
# mount –t nfs <ip address> </dir name> /mnt
To unmount:
# umount /mnt

Paging Space Administration -AIX

All these questions about paging space will be answered in this very particular post.
1) What is Paging Space?
In a system, there are multiple processes running. For a new process to be actively running, the process should be loaded into the OS memory. Once the process is loaded, it is then assigned number of 4 KB units called page frames.
Keeping this in view, more number of additional processes is loaded into the memory with each process assigned 4 KB areas. But when the processes are overloaded and the memory is full, OS scans memory to trace frames that are least recently used. When such a frame is discovered, 4 KB block or page of disk space is allocated and the data from least active frame is moved to area on the disk. This area on disk is called Paging Space.
2) What is Page-in & Page-out?
If the paged out information for the least active process is needed back into the memory, the page is retrieved from the disk and brought back into the memory. This is called page-in.
Similarly, when the least active frame is moved out from the memory on to the disk, the process is called page-out.
3) What is thrashing?
If the OS is loaded with many active processes and there is no further real memory available to load additional active processes, the OS goes into the constant state of paging called thrashing as no additional real memory is available to load a new process into the memory.
Increasing the amount of paging Space will be of no benefit because the processes involved are all active and thrashing is the result of not enough real memory.

Software management in AIX

Fileset in AIX is named for softwares or dependencies.
Group of filesets is called a package.
For eg: is a package and is a fileset.
BOS stands for Base Operating System.
BOS is a licensed programming product (LPP).
Bundle : A bundle is a collection of a fileset, package or LPP.
Bundle is of 3 types:
  1. Server bundle
  2. Graphics bundle
  3. Migration bundle
Command used to install softwares is installp
Various commands to install software:
# installp –aVx –d <directory or device name> <application name>
For eg:
# installp – aVx –d /dev/rmt0
a stands for APPLIED mode. Software installed in applied mode means, admin can rollback the software if the wrong version gets installed or software is not suited as per end user requirements. Because the software is not committed to the OS, so rollback is possible.
To commit the software/application permanently in the OS, command used:
# installp –aCx –d <directory or device name> <application file>
For eg:
# installp –aCx –d /dev/rmt0
c stands for COMMITTED mode. Once the application is installed using c flag, it cannot be removed later from the OS. Admin must be very careful in running this command.
To remove an application which is installed in applied mode, command used is:
# installp –r <application name>
To uninstall the fileset, command used:
# installp –u <application name>
To clean broken software parts, command used:
# installp –C
To check all softwares installed in APPLIED mode, command used:
# installp –S
To list all the softwares installed in AIX or LINUX OS, command used are:
# lslpp –l (works only in AIX)
# lslpp –L (works in both AIX as well as Linux)
# lslpp –h <application name>
This command will give complete history about the application including the versions installed.
For eg:
# lslpp –h bos.obj
# lslpp –L | grep APPLIED
Will list all the applications installed in APPLIED mode in the OS.
Command used to find the filesets installed for a particular application is:
# lslpp –f <application name>
Command used to find the filesets installed for running any command is:
# lslpp –w /usr/bin/<command>
For eg:
# lslpp –w /usr/bin/path
This command will give the list of filesets needed to run the PATH command.
# lslpp –c command is used to verify the checksum
# lslpp –v command is used to verify the software parts.
To install softwares in Linux commands used are:
# rpm –ivh <application name>
Install command’s output is always stored in user’s smit.log directory i.e. /home/smit.log
Software components are basically broken down into 3 types:
  1. Root
  2. Usr
  3. Share
Fileset + package together is called a Bundle.
To check using SMIT whether software is installed properly or not, command used is:
# smit list_installed
To report comparison for softwares, command used:
# smit compare_report
To check software management and utilities, command used:
# smit maintain_software
To install fix from a cd, command used:
# instfix –ik <fix number> -d /dev/cd0
To search for a fix by keyword:
# instfix –s <keyword> -d /dev/cd0
To display all fixes available on cd:
# instfix –T –d /dev/cd0
# instfix –I | grep ML command will list all the fixes for ML (maintenance Level)
# instfix –I | grep TL command will list all the fixes for TL (Technology Level)
Formula for RISC (Reduced Instructions Set Computer):
Time to execute a program = number of instructions X number of clock cycles per instruction X time taken for a clock cycle
mkinstallp command creates software package in install format.
To install updates available on a cd and verify the current maintenance level, command used is:
# install_all_updates –d /dev/cd0