Putty How to use?

Source: Internet
Author: User
Tags file copy ftp ssh best linux server pscp server port firewall

Putty Chinese version is a Linux server upload software, with the wide use of PHP programs, Linux server-side applications are also used by us, want to achieve local and Linux servers to transmit data between each other, then the FTP server is indispensable, it not only for us to provide convenient upload services , but also allows us to better manage the relevant source code procedures, and Putty Chinese version is currently the best Linux Server FTP tool, it is completely free of open source, but many users do not know how to properly configure the use of putty, so small series for everyone to provide a detailed method of operation, the need to quickly understand the friend!

First download the Chinese version of Putty in this site

SSH Login Instructions:

The default protocol after opening is the SSH protocol with a port of 22.

Then enter the IP address of the machine you are going to log in to, and a warning will appear if you log in for the first time. Host key.

The host key uniquely identifies a host key (SSH only) prevent spoofing attack

Event Log record control information (right click on the window, select Event log)

Operation:

Copy is directly with the left mouse button drag selected on it, do not press CTRL + C, double click to select a Word, three to select one line;

Paste is also very simple, do not CTRL + V, click the right mouse button.

Alt-The area selected is a rectangle

Use Shift+pageup/pagedown to page up and down, while Ctrl+pageup/pagedown is one line.

Recommended initial:

session->logging->session logging:-> Select printable output logfile name: Enter putty_&h_&m_&d_& T.log

Terminal->keyboard->the Backspace key-> Select the correct backspace key stty-a can check the BACKSPACE keys incorrect BACKSPACE key can be added SHIFT key BACKSPACE

Terminal->bell-> Select beep using the PC speaker or default system alert sound available CTRL+G test

Window-> modified into the appropriate ranks, adding Lines of scrollback (buffer value can be set to 9999, a bit more history saved Records)

Window->appearance->font settings-> Select the appropriate font (font size can be adjusted)

Window->behaviour->window title set to empty (but I am not easy to set to empty, can be modified to the corresponding IP, host a long time to identify)

Window->translate-> choose the appropriate character to check lang. Sometimes garbled solution is found?

(1) Using env | grep LANG View the language used by the system

(2) Then in the character modified into UTF-8 can be.

Window->colours-> cancels Allow terminal to specify ANSI colurs eliminates server-side control colors

Window->colours-> Select a colour to adjust->default foregroud (front color)->modify-> Select the appropriate foreground color (white or green)

Connection->seconds between KeepAlive-> to a number greater than 0 (it will be in 99 seconds when no one to the server contract, to ensure that the connection is not easy to break)

Connection->ssh->x11-> Select Enable X11 forwarding (activate to map the graphical interface to local.)

When the settings are complete, select Default settings in the session, and then click Save

Enter a host address in host name, enter a new name in saved sessions, and save

Double-click to open

Putty's command line

Putty.exe [-ssh |-telnet |-rlogin |-raw] [user@]host

D: Tool Putty-0.60>.putty.exe-ssh 192.168.142.2

. Putty.exe-load VM1

To remove the PuTTY configuration, enter the following command in the console: Putty.exe-cleanup

Pscp

PSCP C:documents*.doc Fred@example.com:docfiles

PSCP fred@example.com:source/*.c C:source

Pscp-ls Fred@example.com:dir1

PSCP Copy command, as the following example:

Copy files from Windows to Linux:

Analysis: Log in as root user 192.168.1.119 host, will/root/install.log this file copy to D packing directory. Executed successfully.

clip_image007

Also, we can copy the files under Linux to Windows:

clip_image008

As Chinese is also supported by OH.

clip_image009

In fact, there are similar commands in Linux: such as the SCP. is the SSH protocol, Port 22.

Psftp

Psftp Fred@hostname-b Batchfile

Similar to SFTP in Linux.

Psftp is like FTP, but ftp with telnet they are plaintext, unsafe. It feels like you're logged on to this host through a terminal.

clip_image010

Plink

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

D: Tool Putty-0.60plink.exe 192.168.142.2

D: Tool putty-0.60plink.exe 192.168.142.2-l Oracle echo Hello, world

With Plink plus 9 users:

C:>plink root@192.168.1.119 "For I in $ (seq 1 9); Do useradd-d/home/guest$i guest$i; echo guest$i | passwd--stdin guest$i; Done

If you need to add a user to more than one machine at a time, you can only modify the corresponding host IP by copying the line above.

Plink root@192.168.142.2/etc/backups/do-backup.sh

A Linux administrator may manage many machines. If the boss lets you do this on every machine, if we log on to each machine to modify it will be very troublesome. Use the above method as long as the IP to modify the line.

Generate Key with Puttygen

The public and private keys are generated, the public and private keys are asymmetric encrypted, and the relevant knowledge can be searched online.

The public key is placed on the server side and the private key is placed on the client, which can be logged in without entering a password.

Open PUTTYGEN.EXE This program, you can directly enter Puttygen in DOS.

Select Ssh-2rsa, then select Generate, in the process of generating a key need to move the mouse, putt will be based on the random movement of the mouse to generate a pair of keys.

Select Save Public key, save the key, and select Save private key to hold the private key.

Client-side settings

Run pageant import client's key

Open the PAGEANT.EXE and add the private key PRI to the local computer.

When set, an icon appears in the lower-right corner of the following figure

Server-side settings

Add the public key to the corresponding file in the home directory of the user you want to log on to: ~/.ssh/authorized_keys, to note that, if you post into more than one line, you should think of ways to revise to a row, ssh-rsa behind a space, key last = There is also a space between the annotations.

Reboot SSH

# svcadm Restart SSH

We're going to open sshd_config this file and look at it.

Before adding the # table annotation, the default value is these, the public key authentication is enabled, the authentication file is in the ~/.ssh/authorized_keys.

Save, exit.

You can also modify the permissions of the. SSH and Authorized_keys This file according to your own needs.

Now we can login directly through the username without entering the password.

Small description: With ll command to view the property, the directory is expressed in blue, can be modified by the following diagram method, the individual does not recommend changes, or show the blue to the intuitive.

We can login via SSH without the need for a password. What about the other commands described above?

Using keys

The pageant is minimized, and the password may not be entered in SSH and plink,scp,sftp.

Take Plink as an example:

clip_image023

There are garbled, but the test is successful, do not need a password can directly execute the command.

Take the SCP as an example:

Need to enter password before no user equivalence is built

C:>d: Tools PUTTY-0.60PSCP D: Tools Putty-0.60pubkey Bbbbb@111.111.145.102:puttypubkey

Using keyboard-interactive authentication.

Password:

PubKey | 0 KB | 0.3 kb/s | eta:00:00:00 | 100%

No password required after building user equivalence

C:>d: Tools PUTTY-0.60PSCP D: Tools Putty-0.60pubkey Bbbbb@111.1111.145.102:puttypubkey

PubKey | 0 KB | 0.3 kb/s | eta:00:00:00 | 100%

Using Port Forwarding in SSH

Using SSH to break through the firewall

Source Fill 3000 Destination fill 192.168.142.2:25

Connect to Port 25th on the server side at client telnet 127.0.01 3000

Forward localhost:3000 as a SendMail server port 25

Iptables-a input-p TCP--dport 25-s 192.168.142.1-j REJECT

Netstat-natp|grep:25

Telnet localhost 3000

Example 2:forward localhost:3110 as a POP-3 server instead of popserver.example.com:110.

The next thing to say is to select the radio button Remote after the establishment of the reverse SSH tunnel, such a tunnel to do what? General firewalls are allowed to link from inside to outside, but not from outside to inside, unless you do NAT or port forwarding on the firewall. Now, you're inside the firewall, but you want to get people outside to link to your machine. The thick gates of the firewall closed, and the people outside couldn't get in, only you can open this guarded door from inside, just like a Trojan horse, you go out and build a reverse SSH tunnel, and then someone outside can easily break through the firewall link to your local machine through this reverse SSH tunnel.

Source Port Here is 8080, the entrance to the tunnel is the port 8080,destination here to fill in the localhost:7001, that is, the tunnel exit is the local 7001 port, the following radio button to select Remote, said the establishment of the tunneling The road is a reverse tunnel, fill out don't forget to point Add button, in the above can see is R8080 localhost:7001. After successfully logging into the remote host guantouping, the reverse tunnel is established. Enter commands on the remote host guantouping telnet localhost 8080 to connect to your local port 7001.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.