Tips for working effectively with Putty. Putty how to use - putty ssh, hotkeys Security warning

Today, SSH is the most common protocol that allows you to quickly and securely connect to your servers to configure them and solve other administration tasks. In this article, we will look at the popular SSH client PuTTY, which allows you to manage servers based on Linux/FreeBSD operating systems.

We will not tell you how to perform basic actions with the program in this article. I suggest you familiarize yourself with the settings and functions that will help you work with PuTTY more efficiently.

Increasing the number of terminal lines

Often, as a result of some action, a large amount of information is displayed in the console, and you need to scroll through it. However, the default settings limit output to the last two hundred lines. To change this parameter, open the settings window, go to the Window category and change the Lines of scrollback parameter to a value that suits you, for example, 5000.

Useful hotkeys

Copy and paste text

To copy text from the PuTTY console, you just need to select the text - it will automatically be copied to the clipboard. To insert text into the console, use the Shift+Insert key combination, or you can simply right-click in the console.

Editing an Input Command

Ctrl+A – move the cursor to the beginning of the input line
Ctrl+E – move the cursor to the end of the input line
Alt+F – move the cursor to the next word in the input line
Alt+B – move the cursor to the previous word in the input line

Ctrl+U – delete all characters preceding the cursor; convenient to use for complete removal printed command
Alt+BackSpace, Ctrl+W – delete the word preceding the cursor

Scrolling text

Of course, the most natural way is to scroll with the mouse wheel. But scrolling with hotkeys is faster in many cases. If you want to improve your work efficiency, give it a try.

Shift+PageUp – scroll text up
Shift+PageDown – scroll text down
Ctrl+PageUp – scroll text up line by line
Ctrl+PageDown – scroll text down line by line

Additionally

Ctrl+C – interrupt execution of the current command
Ctrl+L – clear screen

Transferring PuTTY sessions to another computer

Let's imagine a situation where you need to transfer sessions created in PuTTY to another computer. The easiest way is to move the corresponding registry branch. To do this you need in the command line Windows line run the following command:

C:>regedit /e "%userprofile%\desktop\PuTTY.reg" HKEY_CURRENT_USER\Software\Simontatham

After that, the PuTTY.reg file will appear on the desktop, which must be transferred to another computer, run and agree to import the registry branch.

Authorization without using a password

If you are used to using a login-password combination to access the server, then I can offer you a simpler and safe way authorization on your server. And if you have several servers, and the passwords are different everywhere, then this option will greatly simplify your life.

PuTTY supports public key authentication. You can generate a pair of keys: public and private. You place the public key on all servers where you want to authenticate using this method, and keep the private key at home in a safe place.

So, let's start setting up this authorization method.

Let's run the PuTTYgen program, which is installed with PuTTY.

In the next window, select the SSH-2 RSA key type. And indicate in the Numbers of bits in a generated key field the value 2048.

Then click Generate and move the cursor within the window until the progress bar is filled.

Next, click Save public key and save the public key under the name id_rsa.pub. Click Save private key and save the private key under the name mykey.ppk, agreeing to save the key without using a password.

Now you need to copy the public key to the server. This can be done, for example, using the PSFTP utility, which is also installed with PuTTY.

Open the program and enter:

psftp> open youserver.ru
psftp> put id_rsa.pub /tmp/id_rsa.pub

ssh-keygen -i -f /tmp/id_rsa.pub >> /root/.ssh/authorized_keys

And finally we launch Pageant.

After which an icon will appear in the tray. Right-click on it and select AddKey. In the window that appears, add the private key mykey.ppk. That's all, from now on you will no longer be asked for a password when logging into the server.

Other programs for working via SSH

If you have several servers and want to work with them more efficiently, then try a convenient “wrapper” for PuTTY – PuTTY Connection Manager. You can download it from here.

Bitvise SSH Client

This product is similar to PuTTY and its use should not cause problems. The main advantage of Bitvise SSH Client is the presence of a very convenient two-panel file manager that works via the SFTP protocol. The program is free and available for download from the official website.

SecureCRT

A paid alternative for those who are willing to part with $99. The client has more functionality than PuTTY. Among them, for example, is the ability to create keys in the application itself, remember passwords, and automatically connect to a remote server.

30 May 2014 | Author: dd |

Of course, it’s interesting when some knowledge is at the subcortex, at the level of instincts - yesterday on the forum they asked how to paste from the clipboard in the puTTY terminal client.

The question even stumped me at first, because... If you’re distracted from work, you won’t even remember it. It seems that you can insert it into puTTY by right-clicking the mouse, but you can’t say for sure, because this is already at the level of reflexes. So I had to go check it out and at the same time edit something on the server. Moreover, the person began to cry that he could not find any information on the subjects on Tyrnet. But I know from somewhere that in puTTY all copying and pasting is done through the mouse, and I was not born with this knowledge:

paste into puTTY from the clipboard by right-clicking (as an option Shift+Insert);
copy to puTTY – select the text and left-click.

Only when inserting text, you need to take into account the fact that if you accidentally copied the next line to the clipboard, then the transition will follow the ENTER input and, as a result, the command will be executed.

So yesterday, trying again, I had to constantly kill them from the processes.

Clipboard operations in puTTY, 5.3 out of 10 based on 9 ratings

Blindly enter your password each time to log into the server ( especially if it is “good”, that is, long and not memorable) is extremely tiring. Therefore, the standard saving of a connection session with a server in PuTTY leaves much to be desired. And I really want to log into the server in one, maximum two clicks! This raises the question: “ How to run PuTTY with password?“And what’s strange is that there is an answer to this question. Even two! =)

Safety Warning!

The methods of storing data (login and password) outlined in this article are not secure!

If an unlimited number of people have access to your computer, then it is better to refrain from using them, since the data will be stored in open (unencrypted) form! Data will be transmitted over the network using the protocol selected in PuTTY, so there is only one threat: the data can only be stolen from your computer while you are out for coffee and a croissant. ;)

Primary settings

In order to run PuTTY with a password, you must first save session settings in it. With these settings, further login to the remote server will be carried out.

Option one. Launch PuTTY with password, running the bat file with user data

To begin with, of course create a bat file. It’s probably worth naming the body file something meaningful and placing it in a place where it will always be at hand when you need to log into the server. After that write it in the following information:

Cd %ProgramFiles%\Putty\ start putty.exe -load SERVER_NAME -l USER_NAME -pw PASSWORD

To make it clear what these two lines mean, let me explain:

  • cd - command to navigate through directories (then is an absolute path, so the batch file will be launched from any place where it is located, even from a flash drive)
  • %ProgramFiles% - operating constant Windows systems, which denotes the absolute path to the Program Files folder. There is a space in the name of this folder. That is why this constant is used
  • %ProgramFiles%\Putty\ - absolute path to the directory (standard when installing PuTTY), where the putty.exe program is located. Where it was installed, it lies there. If to another location, this path needs to be changed to the one on your computer
  • start - Windows team to execute the file. If you do not specify it, two windows will open: one Windows console, the second PuTTY window itself with open session with the server. Why should we leave open window Windows console?
  • putty.exe is the actual PuTTY program file, which we launch with the following parameters:
    • -load - open the server specified in the SERVER_NAME parameter
    • -l - precedes the username specified in the USER_NAME parameter

You entered everything, entered your data, and saved the changes in the bat file. Now, double-click to launch the batch file and immediately go to the server under the user whose data is saved. Comfortable! =) But not safe (as I wrote above).

Option two. Launch PuTTY with password, specified in the program shortcut putty.exe

As is clear from the name of this option, the first thing you need to do is create a program shortcut putty.exe. It makes sense to name the shortcut so that you can understand which session data is stored in it, so as not to get confused. Since the paths to the program in the shortcut are indicated in absolute form, then the shortcut can be moved to a place where it will always be at hand and not noticeable to those who want to steal the data stored in it ( server login and password).

After the shortcut is created, open its properties:

In the window that opens, on the tab “ Label" to the line " An object» add data about our connection to the server in the form:

"C:\Program Files\PuTTY\putty.exe" USER_NAME@SERVER_NAME -pw PASSWORD

  • "C:\Program Files\PuTTY\putty.exe" - the path to the putty.exe program, written in quotes
  • USER_NAME - the username that we previously entered manually each time when logging into the server
  • @ - this is the icon =)
  • SERVER_NAME - the name of the server saved in PuTTY sessions with which we are establishing a connection
  • -pw - precedes the user password specified in the PASSWORD parameter
  • PASSWORD - user password to log into the remote server

And press the button " OK».

For security purposes, Windows may ask you to confirm changes in the shortcut parameters. Here you just have to agree. =)

That's basically all.

Conclusion

If there is saved data in PuTTY sessions that matches the data saved in the shortcut and/or bat file, then when you run the batch file or double-click on the shortcut, a session will open immediately with the logged in user, which is extremely convenient, but not very safe, because To. all data is stored in clear format.

PuTTY– software client remote connection and settings Linux servers, Telnet terminals, network routers. With PuTTY you can connect via network protocols SSH, Telnet, Rlogin to end hosts; configure devices via serial Com port.

PuTTY how to use or connect via PuTTY SSH

Open the PuTTY program and in the “Session” category indicate the host name or IP address of the server, by default we use port 22. We enter the session name and click the “Save” button, this is done so as not to re-enter the IP address each time the next time you connect to the server.

Before saving the connection, you need to click on the “Change” button in the “Windows” - “Appearance” category and select “Cyrillic” from the character set, then check the encoding in “Translation”, which should be set to UTF-8 - these settings will ensure correct display Cyrillic characters. Connection is set!

Note: To successfully connect to a server, terminal or network router, an SSH server must be configured on the terminal equipment side, port 22 must be open and local computer from which you are connecting, disable Windows Firewall/Firewall.

Let’s try to connect to the SLES 12 SP1 x64 server by clicking on the “Open” button, as shown in the first figure. During the initial connection, a warning window will be displayed that the Putty program will write down the remote server encryption key, confirm by clicking the “YES” button.

A terminal window opens, where you need to enter your username and password to log into the system; after each entry, press the “Enter” key. No characters are displayed when entering a password. A successful connection to the SSH server is determined by the last login and the appearance of the host name.

To control the system you must use Unix commands, Cisco and others. For more convenient management of the Linux system, I recommend using MC – Midnight Commander ( file manager with a text interface).

An example of the output of the command ls -ls entered (shows detailed output of the list of files, access rights, owner group, size of each file, date, etc.):

PuTTY hotkeys

The main and most important thing is copy paste To copy text from anywhere to the clipboard, you need to press the Ctrl-C key combination and paste it into the PuTTY window using the Shift-Insert hotkeys or by clicking the right mouse button, thereby pasting the text into the console. If you need to copy/paste text in the PuTTY window itself, then simply select the text in the window and paste in the same way as indicated earlier.

Ctrl+A – go to the beginning of the line

Ctrl+C – end the current command

Ctrl+D – termination of the work session (command “exit”)

Ctrl+L – screen shift, everything that was previously entered will move to the very top

Ctrl+P – output of previously entered commands (pressing Up/Down arrows)

Ctrl+U – delete line

Ctrl+W – delete one word in the current line

Ctrl+Z – stop the current command

IN operating systems Linux family for remote access SSH protocol is widely used between machines. Its popularity is due to the simplicity, reliability and security of the connection. Connecting via SSH to remote computer, you get the opportunity to execute any terminal commands on it, as if you were working on your computer, even autocompletion and other auxiliary features work.

Sometimes there is a need to connect to a remote Linux computer from Windows, but by default, there is no utility designed for this. Eat third party program, it's called PuTTY and you can install it separately. In this article we will look at how to use PuTTY to connect to Linux systems, and we’ll also talk about how PuTTY is configured for easy use.

First you need to download the program installer. To do this, open the official website and click "You can download PuTTY here":

Then select the installer for your architecture, x86 or x64, and download it.

In the first step, click "Next":

The installation folder can be left as default:

Components too:

Wait for the installation to complete:

Uncheck "View README" and press "Finish":

Now let's move on to how work is done in PuTTY.

How to use PuTTY

1. Program interface

Immediately after launching the program from the start menu, you will see GUI its settings. After connecting, you will only see the terminal, but you can configure the program through a convenient interface.

Let's look at what these or those program tabs are responsible for, so that you can know what and where to look. We have four tabs:

  • Session- responsible for connection remote server, here we enter the connection parameters, port, address, and we can also save all putty settings so as not to configure it again each time.
  • Terminal- allows you to enable or disable terminal capabilities;
  • Window- setting appearance windows, color, font, encoding;
  • Connection- setting connection parameters, encryption algorithm, compression, authentication keys, X11 and other parameters.

Each tab has several subsections, but we will not touch them now, but will go straight to practice and see how to connect putty to a remote node.

2. Connect to a remote computer PuTTY

To connect to a remote computer via SSH, go to the tab "Session", here in the field "Host Name" you need to enter the IP address or host name of the computer you want to connect to in the port field - you need to specify the port on which you are running SSH server, the default is port 22:

Then you will need to enter your username and password. It is important to note that you will not be able to copy your login or password; you only need to enter it manually:

3. Saving a PuTTY session

In order not to enter the ip and port every time, you can save this data as a session, to do this, write a new name in the field "Saved Sessions" and then click the button "Save":

You will now be able to load your saved session by clicking the button "Load".

After the putty setup is completed and all parameters are set correctly, you can save the settings and not enter them several times.

4. Default username

You don't have to enter your username every time; to do this, go to the tab "Connection", then "Data" and in the field "Auto-login Username" enter the username, for example, root:

Now the putty connection will be performed on behalf of this user.

5. Authorization using ssh key in PuTTY

In order not to enter a password every time, you can set up authorization using a key. In Linux, this feature is used very widely because it is convenient. The first step is to create a key. To do this, run the PuTTYgen utility and set the switch to "SSH-2 RSA" click "Generate":

The key must be SSH-2 RSA, if not in the main window, select from the menu "Key". Move your mouse to create enough entropy:

The key is ready, then using the buttons "Save Public Key" And "Save Private Key" save both keys.

Here you need to click the button "Browse" and add the recently saved private key:

Next, return to the tab "Session", select our save and click “Save” to save the settings. All that remains is to send our public key to the server. To do this, log in to it using a password and paste the public key at the end of the /root/.ssh/authorized_keys file.

The key can be taken directly from the PuTTYgen window "Public key for pasting" or from the public key file:

That's it, now you can log out and log in again. This time the connection via ssh putty will be performed using our key. Don't forget to save your session settings so you don't have to select a key every time. Now you know how to use putty, let's look at transferring files.

5. Transferring files via scp to PuTTY

Not everyone knows, but PuTTY allows you to transfer files via ssh just like Linux does using the scp utility. Press Win+R, then type cmd to launch the command prompt.

The pcsp utility syntax is as follows:

pscp options file_path Username@host: /path/to/file/on/remote/host

For example, we can send a file from the current folder to the user's /root/ folder:

pscp test.txt [email protected]:/root/

You can use the -P option to set the remote port:

pscp -P 2250 test.txt [email protected]:/root/

And the load option allows you to load saved PuTTY session settings:

pscp -load losst-2 test.txt [email protected]:/root/

Now you know how to use putty to transfer files.

conclusions

In this article, we looked at how to use PuTTY to solve Linux administration problems on Windows. Sometimes situations happen that you can’t do anything without ssh in Windows, then this utility will be simply irreplaceable.