Use PuTTY key authentication mechanism to remotely log on to Linux
1. Download puttygen.exe in the puttytool package.
The putty tool is compact and easy to use. You can download it from Baidu for free.
2. Double-click puttygen.exe and set "Number of bits in a generated key" in the lower right corner to 2048. Then, click "Generate" to Generate the key and move the mouse back and forth to quickly Generate the key pair. "Key comment" remains unchanged and can be customized. A brief introduction to the Key is provided. "Key passphrase" sets a password for the Key. You only need to enter this password to log on to linux next time; "Confim passphrase" Again enters the password you just set.
3. Save the private key and click "Save private key". In the pop-up window, select the address for saving the private key and name it for easy differentiation.
4. Copy the public key to remote linux.
Return to the Key generation window. A bunch of strings below the "Key" are the generated public Key content. copy it and paste it to the remote linux/root/. ssh/authorized_keys file. If there is no. ssh directory, you need to create one and change the directory permission to 700.
[Root @ localhost ~] # Mkdir/root/. ssh
[Root @ localhost ~] # Chmod 700/root/. ssh/
[Root @ localhost ~] # Vi/root/. ssh/authorized_keys
Paste the contents of the public key, save and exit.
5. Disable Selinux.
If Selinux is not disabled, the system prompts "Server refused our key" when you log on with the key"
There are two ways to disable selinux:
Temporarily disable selinux firewall. selinux will be enabled after the next restart.
# Setenforce 0
# Getenforce # command for temporarily disabling selinux
Permanently disable selinux
# Vi/etc/selinux/config # modify the selinux configuration file
Change "SELINUX = enforcing" to SELINUX = disabled and save and quit.
[Root @ localhost ~] #/Usr/sbin/sestatus-v # view The selinux STATUS Command
SELinux status: disabled
6. Disable the Firewall
[Root @ localhost ~] # Iptables-F # clear firewall configurations
[Root @ localhost ~] #/Etc/init. d/iptables save # Remember to save the configuration after clearing the Firewall
Iptables: Save the firewall rules to/etc/sysconfig/iptables: [OK]
7. Set putty to log on with a key
Open the putty tool and select "Private key file for authentication" on the right side of Connection -- SSH -- Auth on the left side and click "Browse" to select the previously saved Private key file.
8. Use key verification to log on to remote linux
Open the putty interface and click "Host Name" in the "Session" window on the left to fill in the remote linux IP address. The "port" port is set to 22 by default, "Connection type" is maintained by default as SSH. You can name the session under "Saved Sessions" to facilitate the marking. after entering the information, click "Save" on the right. You do not need to enter it again next time you log on. Next time you log on, select the saved session and click "Load" on the right to Load the settings. After the configuration is complete, click "Open" below to Open the logon interface.
Putty interface "Window" -- Translation option, Remote character set: Select UTF-8 to avoid garbled;
Log on as the root user and enter the password set when the key is generated. The interface is as follows:
Login as: root
Authenticating with public key "rsa-key-20150311"
Passphrase for key "rsa-key-20150311 ":
Last login: Wed Mar 11 19:26:27 2015 from 192.168.20.1
[Root @ localhost ~] #
Some simple and practical modifications to the original settings when using PuTTY
How to Use Putty to implement remote logon control on Linux platform
How to connect Putty to Ubuntu in VMWare
VMware + Linux + Putty environment Configuration
This article permanently updates the link address: