19 C
Jaipur
Wednesday, October 28, 2020

Useful PuTTY Configuration Tips and Tricks

Must read

Best Tools to Create a Bootable Linux USB Drive

Bootable USB is a USB drive that is used to boot up a computer or laptop for installation on an operating system.Unlike Windows, Linux...

Samsung Galaxy S21 May Ditch Bundled Earphones And Charger Like Apple

A few weeks ago, Apple made headlines after announcing that the iPhone 12 won’t ship with a charger or a pair of earphones. And now it...

China launches crackdown on mobile web browsers, decries ‘chaos’ of information – Latest News

China's top cyber authority said it would carry out a "rectification" of Chinese mobile internet browsers to address what it called social concerns over...

cellphone: Japan unveils plan to prod carriers to cut cellphone charges – Latest News

Japan on Tuesday laid out a plan for reducing consumers' cellphone charges, as the government stepped up its bid to promote competition in the...

Putty is an opensource terminal emulator that supports several network protocols like Telnet, SSH, Rlogin, SCP, and Raw Socket.

The initial version of putty is dated back to January 8, 1999, and designed for Windows Operating system but now it is supporting other operating systems like macOS and Linux too. But I have never seen people using Putty in Linux or macOS because it ships with beautiful Terminal.

There are many more alternatives available but each has its pros and cons. You can play with different options and let us know which serves the best.

Putty Alternatives

  1. MobaXTerm
  2. Kitt
  3. Solar-PuTTY
  4. mRemoteNG
  5. Termius
  6. Xshell6
  7. ZOC
  8. Supper Putty

Since the sole of the article is to discuss putty lets jump into it right away. The context of this article is created under Windows 10 environment.

Putty Installation

Go to the official putty site to download the binary and install it. Installation is pretty straight forward as like any other normal windows installation. At the time of writing this article, the current version of putty is 0.74.

There are some utilities that come with the installation and we will see their uses.

Putty Utilities

  • PUTTY – SSH and Telnet client.
  • PSCP – Command-line utility to copy files securely.
  • PSFTP – general file transfer sessions much like FTP
  • PUTTYGEN – Utility to generate RSA and DSA key.
  • PLINK – Command Line interface to putty back ends.
  • PAGEANT – Authentication agent for Putty, PSCP, PSFTP, and Plink.

You can also download these utilities as standalone binaries.

How to Start and Use Putty SSH Client

When we launch putty first thing you will see is a dialog box that controls everything that we can do with putty. Configuring session and related parameters are pretty easy in putty through this dialog box.

Putty SSH Client

Let us now explore some important options from the dialog box.

Remote Server Connection

To connect to any remote servers via SSH we will use either IP address or FQDN (Fully qualified domain name). By default, SSH is bonded to port 22 unless the SSH port was changed.

There are 4 connection types available RAW, Telnet, Rlogin, SSH, Serial. Most of the time we will use either Telnet or SSH connection.

We can also configure our sessions and save them. This allows us to reopen our session with all the configurations retained.

Putty Remote SSH Connection
Putty Remote SSH Connection

You will get an alert as displayed in the below image either when you connect with the server for the first time or when the SSH protocol version is upgraded. Putty registers the host key of the server in the Windows registry so it can verify against the key whenever we log in to the server and throws warning in case of a change in host key. This is one of the features of the SSH protocol to prevent any network attack.

Putty SSH Key Alert
Putty SSH Key Alert

Enable Wrap Mode on Putty

When a long line of text reaches the end of the right-hand window, it will wrap over the next line. To use this feature, we need to select the checkbox “Auto wrap mode initially on”. If Wrap Mode is set to off will it create a horizontal scrollbar? well, no. It simply will not display the lines that are greater than the length of the page.

Enable Wrap Mode on Putty
Enable Wrap Mode on Putty

NOTE: This setting can also be changed in the middle of an established session which will be taken into immediate effect.

Increase Window Scroll Buffer Size

There is a limitation on how many lines of text putty keeps. When you are working with very large files or trying to display log files putty only keeps a few lines of it in windows buffer for us to scroll back and see. To increase the scrollback buffer size, we can increase the value “Lines of scrollback”.

Increase Scroll Buffer Size
Increase Scroll Buffer Size

You can also change some behaviors when the window is resized like changing the size of the font.

Enable SSH Keep Alive Time

There might be situations where you will encounter ‘Connection reset by peer’ error because of our session is idle for a long time. In such a case, the connection will be closed by the network devices or firewalls assuming the session is completed.

We can set keepalives so null packets will be sent to prevent connection drop. Values mentioned in Keepalives are measured in Seconds. Keepalives are supported only in Telnet and SSH.

Putty - Set SSH Keep Alive Time
Putty – Set SSH Keep Alive Time

Enable Auto SSH Login with Username

Whenever you connect to a session it will prompt with username and password. Instead of typing username every time you can set the user name under Login details.

Putty - Auto SSH Login with Username
Putty – Auto SSH Login with Username

You can also configure your session for password less login using SSH (Public & Private) key authentication. To know more about generating and configuring password less login take a look at this article.

Customize Window Title

By default, putty will display “hostname – PuTTY” as a window title name. We can override this option by setting a new title under “Window title”.

Putty - Set Window Title
Putty – Set Window Title

We can use “Alt-Enter” to toggle to Full-Screen mode but before that, we have to enable this feature. Select the tick box as shown in the image.

Customize Putty Terminal Appearance

You can change the color scheme and appearance of the putty terminal. There are some nice collections of color schemes for putty in GitHub.

Change Putty Color Schemes
Change Putty Color Schemes

Change the appearance like font, font size, cursor appearance, etc.

Change Putty Fonts
Change Putty Fonts

Enable Rich Text Format

Enabling this option allows the copied text to be stored in the “Rich Text Format” in the clipboard. Whenever we copy and paste the content to any word processor the colors, format, the style will remain the same as in PuTTY.

Enable Rich Text Format
Enable Rich Text Format

Enable Putty Logging

Logging is an important feature in putty. We can store our session output to a text file which can be viewed later for a different purpose.

Enable Logging in Putty
Enable Logging in Putty
Points to Note:
  • You can control what should be logged through the “Session logging” option. In my case, I am capturing all of my session output.
  • If the log file already exists in the given path then we can either overwrite or append the logs.
  • Date and Time options are available to format the log file name which is very handy.

Now I tried connecting to a remote machine which is running Linux Mint 19 and storing the output locally. Whatever I type in my terminal, its output is captured in session logs.

Putty Session Logs
Putty Session Logs

There might be times where we might need to connect to multiple sessions or restart the current session or duplicate the current session. Right-click from putty title bar where we have options to start/restart/duplicate sessions. We can also change the settings for the current session from the “Change Settings…” option.

Putty New Sessions
Putty New Sessions

Putty Telnet Session

Telnet connection can be established when we use connection type as “Telnet”. By default, port 23 is taken, different ports can also be used to check if ports are opened or not.

Putty Telnet Session
Putty Telnet Session

Export and Import Putty Sessions

In the previous section, we discussed how to connect and configure a session. Now, where does this session information is stored?

Putty Sessions
Putty Sessions

Session and its related information are stored in the windows registry (HKEY_CURRENT_USERSOFTWARESimonTatham). We can export the session and can import it in a different machine to retain the configurations.

To export session related information, from windows cmd prompt:

regedit /e "%USERPROFILE%Desktop.reg" HKEY_CURRENT_USERSoftwareSimonTathamPuTTYSessions
Export Putty Sessions
Export Putty Sessions

To export all settings, from windows cmd prompt:

regedit /e "%USERPROFILE%Desktop<Name of your file>.reg” HKEY_CURRENT_USERSoftwareSimonTathamPuTTYSessions
Putty All Sessions
Putty All Sessions

To import settings, either you can double click the .reg file or import it from cmd prompt.

Import Putty Sessions
Import Putty Sessions

Putty Command Line

Apart from GUI interface putty also allows users to do various things from cmd prompt (Windows). Below are a few of the useful commands.

Establish an SSH connection:

putty.exe -ssh <IP ADDRESS (OR) FQDN>:22/

Establish a Telnet connection:

putty.exe telnet:<IP ADDRESS (OR) FQDN>:23/

Note: Syntax between SSH and Telnet command differs.

To load the saved session:

putty.exe -load “session name”

Registry Clean-up:

putty.exe -cleanup

Important flags:

-i 		- 	Specify the name of private key file
-x or -X 	- 	X11 Forwarding
-pw 		-	Password
-p		-	Port number
-l		-	Login name
-v		- 	Increase verbose
-L and -R	-	Port forwarding
Wrap Up

In this article, we have seen how to install and configure, various supported protocols, command-line options, and some alternatives to putty.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Best Tools to Create a Bootable Linux USB Drive

Bootable USB is a USB drive that is used to boot up a computer or laptop for installation on an operating system.Unlike Windows, Linux...

Samsung Galaxy S21 May Ditch Bundled Earphones And Charger Like Apple

A few weeks ago, Apple made headlines after announcing that the iPhone 12 won’t ship with a charger or a pair of earphones. And now it...

China launches crackdown on mobile web browsers, decries ‘chaos’ of information – Latest News

China's top cyber authority said it would carry out a "rectification" of Chinese mobile internet browsers to address what it called social concerns over...

cellphone: Japan unveils plan to prod carriers to cut cellphone charges – Latest News

Japan on Tuesday laid out a plan for reducing consumers' cellphone charges, as the government stepped up its bid to promote competition in the...

oneplus 7t: Amazon sale: OnePlus 7T selling at Rs 32,999 in upgrade deal

OnePlus 7T has got a price cut of Rs 7,000 during the Amazon Great Indian Festival sale. The handset is available at a...