PuTTY is the best SSH client and it’s free. But it lacks of this little function that I really want - Automatic login.
So I have searched many Google pages and found this PuTTY Connection Manager which I explained details in my previous post. It is a very good software.
But somehow I wanted the auto login function without the extra programs. I wanted it to be done directly with PuTTY, not within the frame of PuTTY Connection Manager.
And I found this software called AutoHotKey (http://www.autohotkey.com/) which can automate keyboard and mouse actions. But I gave up to use it at that time because I was too lazy to read all the instructions and to come up with a script for the auto login.
But yesterday, I decided to take a look again and this time I successfully created the Auto Login script! To tell you the truth, it was not easy but it is worth it. I am proud of myself
So here is the script.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| v_program=%A_ProgramFiles%\PuTTY\putty.exe -load putty_profile
v_userid=youruserid
v_passwd=yourpasswd
v_wait_userid=1000
v_wait_passwd=500
;-------------------------------------------------
; To make modifier keys to work properly (such as Shift)
SetKeyDelay, 0, 10
run, %v_program% , , , newpid
;you need to wait a little for the window to initialize
;sleep, 100
winwait, ahk_pid %newpid%
;wait for the login prompt to appear
sleep, %v_wait_userid%
ControlSend, , %v_userid%{enter}, ahk_pid %newpid%
sleep, %v_wait_passwd%
ControlSend, , %v_passwd%{enter}, ahk_pid %newpid%
;create unique title so you won't be lost
WinGetTitle, v_title, ahk_pid %newpid%
v_newtitle=%v_title% - %newpid%
WinSetTitle, ahk_pid %newpid%,,%v_newtitle% |
If you want to try this yourself, you will need to change some information.
- Install AutoHotKey software.
- Create any file name with extension .ahk. For example ’ssh.ahk’ would be fine.
- Copy & paste above code into the file. But need to change the values.
v_program: PuTTY location with the -load option and connection profile name
v_userid: userid
v_passwd: passwd
v_wait_userid : msec to wait before sending userid
v_wait_passwd : msec to wait before sending passwd
- Save it and double click on the file to execute it. And watch the PuTTY logging in the server automagically!
In fact, you can easily add additional commands at the end of the script to execute further commands.
Below is an example.
1
2
3
4
5
6
7
8
9
|
;maybe you want to wait some seconds while initial welcome screen appears. Let's say 2 seconds.
sleep, 2000
;cd upload
ControlSend,,cd upload{enter} , ahk_pid %newpid%
;You can send the folder list to your email account.
ControlSend,,ls|mail -s "Daily File Listing for Upload" your@emailaccount.com{enter}, ahk_pid %newpid% |
Note that there is a little issue that the password is saved as plain text. But I can live with it for now.
Here is my script in action.
Come visit again for more information on PuTTY.

This is a simple tip for PuTTY Configuration.
When you first use PuTTY , you will find the cases that BACKSPACE would not work and showing as strange sequence of ^ and question mark (^?^?^?) for some UNIX servers.
You can fix this problem just by changing the setting. Select Terminal Keyboard at the left TreeView control of the main PuTTY screen and select Control-H instead of default Control-?(127).
Also make sure you save the settings.

Come visit again for more information on PuTTY Automation and Configuration Tips.
Automatic Login or Login Macro function - Have you ever wanted to make the PuTTY login session automatic?
PuTTY is a great free telnet ssh client and I wouldn’t trade with any other client. But it lacks of this minor function that I really want - Automatic login.
Maybe the automatic login is not a big deal. You can just type in the userid and the password each time you log in to the development server . But if you do that regularly everyday, opening several times throughout the whole day, you would understand and agree with my little wish.
So I been looking for the solution , going through the every results of the Google search.
And here is the great helper application that can do automatic login macro!
PuTTY Connection Manager (http://puttycm.free.fr/) is the great .NET 2.0 application that can do the automatic login. Moreover, it supports tabbed windows just like the Firefox does it. Also it has quick connection menu bar that you just type in the address and connect which can be also useful.
Features
- Tabs and dockable windows for PuTTY instances.
- Able to load the profiles created from PuTTY.
- Login macro - You can define Userid and Password and extra commands to execute after login.
Requirements
It can be little confusing when you first use the software and to use that Login Macro. By default the PuTTY CM shows existing PuTTY Session profiles in the TreeView located in the right pane. Don’t be fooled, you cannot set Login Macro with the existing PuTTY Session profiles. You will need to create a new database to do that.

- Create a new database from File menu.
- You will see the newly created database icon in the right pane, above the PuTTY Session item. Copy the profile you want to set Login macro from the PuTTY Sessions and paste into the new database you just created. You can use traditional ctrl+C and ctrl+V shortcut.
- Right mouse click on the newly created item under the database and select Configuration.
- A new window dialog will show up with the same connection information as the original PuTTY profile. Check on the “Enable Login Macro Mode”.
- Select “Login Macro” in the left TreeView and you will be able to define the userid ,password, timeout seconds, and post login commands.
- After inputting data, click on the OK button and connect by double clicking the item.
Also, don’t forget to save your database settings, so you can use the settings later on.
Come visit again for more information on PuTTY Automation.
I was using the PuTTY with several profiles stored and was happy with it. One day, I got this new labtop and decided to migrate whole desktop system to this new labtop.
But for PuTTY,there was no menu for the profile export. So I spent some time to find out how to do it.
The solution was posted in the FAQ of the PuTTY Homepage.
A.5.2 Where does PuTTY store its data?
On Windows, PuTTY stores most of its data (saved sessions, SSH host keys) in the Registry. The precise location is
HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
Alright, you can extract Registry data by using regedit. Open regedit and browse the path in the left treeview upto HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
Once you highlight the PuTTY node, click right mouse button and select the ‘Export’ Menu. A new Save Dialog window will be shown and you will be able to save the information into a file.

After you copy the data file (*.reg) to the new computer, you can register it to registry by simply double clicking on the file.
Updated : 20070629
Here is a better way to do it
Create a batch file that executes regedit.
regedit /ea putty.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
Run it by double clicking. Then you will get putty.reg.

Then you can send it to your Gmail account and download the file from any other computer connected to the Internet and import it by double clicking again.
And here is the batch file if you are lazy enough to download one instead of creating one by yourself.
http://www.neox.net/w/wp-content/data/putty_export.bat
They used to charge high prices for the commercial SSH client software.(SecureCRT is one of them) Then this free SSH client was released in the Internet. And we are able to enjoy secure shell environment for free! Thanks to Simon Tatham. Below is the excerpt from the PuTTY homepage.
PuTTY is a free implementation of Telnet and SSH for Win32 and Unix platforms, along with an xterm terminal emulator. It is written and maintained primarily by Simon Tatham.
If you are a developer or a system admin , you may access to the UNIX server using telnet application everyday. Telnet uses a simple raw data transmission without encryption , so if you use telnet over the public Internet, your authentication data(Password) may be captured and viewed by anyone with the right tool and the motivation. It is very vulnerable and not recommended.
SSH (Secure Shell) is similar to telnet but it is very secure. It encrypts the data before the transmission, so you can rest knowing that your password is safe with you.

When you first run the application, you will see the screen looks like above image. You can right connect to the SSH server right away by typing in the IP or domain name of the host in the HOSTNAME field and press Enter key.
There are various options and settings that you can change by using the items in the left pane. (Windows Color, Font size)
There are few settings that you may want to change before starting a session.
1. Backspace Key: By default, Control-?(127) is the Backspace key, but you may need to set to Control-H.(It depends on the server’s setting).

(more…)