Requirements: Connect to Ubuntu using putty (an SSH client) on the Win7 computer
Tools: Puttygen.exe and Putty.exe
First step: Generate key
Run Puttygen.exe, select the required key type and length, use the default SSH2 (RSA), and set the length to 1024.
The passphrase can be empty, lest you enter the password once when you log in.
Click the Save private Key button to save the private key, such as KEY.PPK;
Copy the contents of the Puttygen public Key text box to the Clipboard.
Step two: Upload the key
Connect the Linux machine with Putty (Linux ssh). exe, and then execute the following command:
$ cd ~ "Open the home directory of the login account"
$ mkdir. SSH "Create the. SSH directory, if it already exists, do not build it, the directory is not visible by default on Linux (in the file browser by ticking the menu View > Show hidden files can see the folder)"
$ chmod. SSH "Modify the file permissions, 700 means to set the read, write, execute permissions for the user (7 at the beginning), without giving permissions to the group and other users (two 0 later)"
$ CD. SSH
$ cat > Authorized_keys "create file with file name Authorized_keys"
Paste the public key character content that you just copied (paste method: Press Shift+ins or right-click in the Putty window);
Then press the Ctrl+d key to save the end of the cat input to the file (Ctrl + C is not to save the end input).
"During the input process, press the ENTER key to immediately save the text you just entered and look up in the file."
$ chmod Authorized_keys
Step Three: Set putty
1) Start the putty, set the parameters of the session (if it has been previously set, then load)
Menu "Ssh->auth", click the Browse button and select the Key.ppk file.
2) menu Connection, Data, Auto-login username fill in the account name of the automatic login, here is WANGXZ, to correspond to the above used
3) menu Session, select Default Settings, click the Save button to save the changes. Then click on the Open button to log in.
If the above operation is not a problem, then run the program directly after this PuTTY.exe can not enter the password automatically login, login prompt as follows:
This concludes.
Appendix : If you are using Putty to log on to another Linux host B on Linux Computer A, you should do one more step, as follows (not verified).
Fourth step: PC A's private key setting
(Run Puttygen.exe,load before the saved KEY.PPK, if not off Puttygen.exe, this step is not necessary)
Select Menu Conversions->export OpenSSH key, save as file Id_rsa, upload to the ~/.ssh/directory of Computer A, so this host can not use the password to log on to the front of the host on the public key B.
$ chmod ~/.ssh/id_rsa
Transferred from: http://blog.csdn.net/hxg130435477/article/details/9960187
[Go] Windows with program putty using SSH to automatically log on to Linux (Ubuntu)