PuTTY

Running PuTTY

To load a saved session, you can create a batch file like so:

ssh2host.cmd
start "" putty -load host.domain.tld

You can even start multiple PuTTYs at once:

ssh2host.cmd
start "" putty -load hostA.domain.tld
start "" putty -load sessionB

Export your PuTTY sessions & settings saved to the registry:

  1. start regedit
  2. Move to [HKEY_CURRENT_USER\Software\SimonTatham]
  3. Export this tree to a file

Pageant

Use pageant to load your private keys into memory. Create a batch file with the following contents and put it in the autostart folder:

pageant.cmd
@echo off
cls
 
start "" "C:\programme\PuTTY\pageant.exe" c:\keys\myprivkey.ppk c:\keys\myotherprivkey.ppk 

Plink (PuTTY Link) is a command-line connection tool similar to UNIX ssh.

This will open an connection to host.example.com and enable Dynamic SOCKS-based port forwarding:

"c:\Program Files (x86)\Putty\plink.exe" -ssh -2 -D 10022 user@host.example.com

Open a saved session and run some commands:

"c:\Program Files (x86)\Putty\plink.exe" -load mysession "cd /; ls -l"

This will give you a directory listing of the root filesystem. plink logs in, executes the command(s) and logs out immediately.

If there are a lot of commands to execute, read them from a file:

"c:\Program Files (x86)\Putty\plink.exe" -load mysession -m commands-file

Configuration

If you want to improve your PuTTY configuration the following two sites are really worth reading:

After reading these blogposts, I decided to tune my own configuration a bit. So I adjusted my “Default Settings”, exported them with regedit and compared them to one of my reference sessions.

The diff boiled down to the following excerpt:

mysession.reg
Windows Registry Editor Version 5.00
 
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\myhost]
"TerminalType"="putty-256color"
"TerminalModes"="CS7=A,CS8=A,DISCARD=A,DSUSP=A,ECHO=A,ECHOCTL=A,ECHOE=A,ECHOK=A,ECHOKE=A,ECHONL=A,EOF=A,EOL=A,EOL2=A,ERASE=A,FLUSH=A,ICANON=A,ICRNL=A,IEXTEN=A,IGNCR=A,IGNPAR=A,IMAXBEL=A,INLCR=A,INPCK=A,INTR=A,ISIG=A,ISTRIP=A,IUCLC=A,IXANY=A,IXOFF=A,IXON=A,KILL=A,LNEXT=A,NOFLSH=A,OCRNL=A,OLCUC=A,ONLCR=A,ONLRET=A,ONOCR=A,OPOST=A,PARENB=A,PARMRK=A,PARODD=A,PENDIN=A,QUIT=A,REPRINT=A,START=A,STATUS=A,STOP=A,SUSP=A,SWTCH=A,TOSTOP=A,WERASE=A,XCASE=A"
"Compression"=dword:00000001
"SshProt"=dword:00000003
"ScrollbackLines"=dword:00004e20
"ScrollOnKey"=dword:00000001
"TermHeight"=dword:00000050
"Font"="Lucida Console"
"FontHeight"=dword:0000000a
"WindowBorder"=dword:00000003
"Beep"=dword:00000000

To apply the new settings to a couple of stored session you can simply replace “myhost” with the name of your session to change, save and double click.

Remember: if there is a space in your saved session name this has to look like this: saved%20Session%20with%20space

One final suggestion: if you're not satisfied with the ANSI colorscheme of your terminal, have a closer look at http://ethanschoonover.com/solarized

windows/putty.txt · Last modified: 2013-12 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready