1, first ensure that the Linxu server installed the SSH service, you can enter the SSH command test.
SSH [ -1246AACFGKKMNNQSTTVVXXYY] [-B bind_address] [-c Cipher_spec] [-D [Bind_address:]port] [-e Escape_ CHAR] [-F configfile] [-I PKCS11] [-I identity_file] [-L [bind_address:]port:host: Hostport] [-L login_name] [-M mac_spec] [-O ctl_cmd] [-o-option] [-p port] [-R [bind_address:] Port:host:hostport] [-S Ctl_path] [w host:port] [-W Local_tun[:remote_tun]] [[Email protected]]hostname [command]
2, CD/~ into the user directory, here must understand the meaning of/~, I use the root account, the corresponding path is/root.
~ is a placeholder, indicating that the address of the personal directory, because each user has their own personal directory address, so use ~ as a unified alternative to the user according to different but the rules can follow the address, to ensure that some cases of compatibility issues. If login with root account ~ represents/root/ if login by name
~ On behalf of/home/name/
3. mkdir. SSH create the. ssh folder.
4, chmod. SSH to the folder authorization.
5, Vim ~/.ssh/authorized_keys create Authorized_keys file.
Take the root account for example, the file path is/root/.ssh/authorized_keys
As for why the file name is Authorized_keys, you can find the following two lines in the/etc/ssh/sshd_config
#PubkeyAuthentication yes#authorizedkeysfile. SSH/authorized_keys
6, chmod authorized_keys to "~/.ssh/authorized_keys" file authorization.
7. ssh-keygen-t RSA generates the key, you can find these 2 files Id_rsa (private key) id_rsa.pub (public key) under the ~/.ssh directory.
[email protected]. ssh]# lsauthorized_keys id_rsa id_rsa.pub
8, CD ~/.ssh into the directory, cat id_dsa.pub >> Authorized_keys will id_rsa.pub the public key content copied to the Authorized_keys file, You can also download it to the window and pass it back.
9, copy the private key file Id_rsa to your windons, open Puttygen, then click Load, the file type in the dialog box select all, load this ID_DSA file, save private key file, later with this the generated private key will have access to Linux, "Puttygen.exe is a software next to Windows."
10. Log in to your Linux server with SSH credentials/vps
putty→ session: Fill in the server IP
putty→ connection → Data: Fill in the automatic login user name
putty→ Connection →ssh→ Authentication: Select Authentication private Key File
Back to putty→ session: Save the session, fill in a name to save it, the next time directly double-click on the name can log in, quickly login it.
11, in order to secure you need to cancel the SSH password authentication method. (optional)
Vim/etc/ssh/sshd_config Editing a configuration file
Passwordauthentication No Add this line
Service sshd restart Restart SSH Services
Reference article:
http://blog.csdn.net/magic_zj00/article/details/7470023
Http://www.jb51.net/LINUXjishu/33586.html
Two Linxu hosts do not link ssh via password
Use Ssh-keygen to generate key Id_rsa, id_rsa.pub
$ssh-keygen-t RSA or ssh-keygen-d (DSA)
The generated id_rsa.pub is sent to the other party's host with SCP. (Need to enter a password)
$SCP id_rsa.pub server_hostname:~/.ssh/
Link to the other host.
$ssh Server_hostname
Copy the contents of the passed Id_rsa.pub Authorized_keys
$cat. ssh/id_rsa.pub >>. Ssh/authorized_keys
If there is no. ssh directory on the other side of the host, then you can create it yourself.
Putty Remote SSH Password-free method link Linxu