Centos SSH Password-free interoperability

Source: Internet
Author: User
Tags chmod ssh centos

Note: SSH password-free interoperability, should be for more than one server communication, I only use a server to do processing. 1, modify the host name.

Vi/etc/sysconfig/network
Networking=yes
hostname=centos1
vi/etc/hosts
#末尾添加 IP host name
192.168.9.129 CENTOS1
Hostname centos1 
#修改主机名临时生效
2, no password login implementation 2.1. Create Public key with Ssh-keygen (each server needs to be executed)
[Root@centos1 ~]# ssh-keygen-t RSA  
generating public/private RSA key pair.
Enter file in which to save the key (/ROOT/.SSH/ID_RSA): 
Enter passphrase (empty for no passphrase): 
enter same PA Ssphrase again: 
Your identification has been saved.
Your public key has been saved in/root/.ssh/id_rsa.pub.
The key fingerprint is:
a0:85:f4:58:d4:c7:2f:d9:ae:b1:04:91:b1:a0:9e:93 root@centos1 the
key ' s Randomart Image is:
+--[RSA 2048]----+
|    . +.. +       |
|   . *. +.O      |
|    + +. O +     |
|   . =. o O    |    | E   S. o     |
|     .    O.    |
|         . +     |
|          o                 |
| | +-----------------+

Password-free interoperability, direct return to complete.

Ssh-keygen: Generate secret key
which
-t specifies an algorithm
-f Specifies the build secret key path
-N Specify password 2.2, view the generated key

[Root@centos1 ~]# CD. ssh/
[root@centos1. ssh]# ls
id_rsa  id_rsa.pub  known_hosts
2.3 Copy the public key to the. SSH directory under the managed machine (make sure this directory exists first)

I am a stand-alone machine here, so I do not need to do this procedure.

Then execute

[ROOT@CENTOS1. ssh]# cat id_rsa.pub >> ~/.ssh/authorized_keys  
[root@centos1. ssh]# ls
authorized_keys  id_rsa  id_rsa.pub  known_hosts
4. Set file and directory permissions:

Set Authorized_keys Permissions

chmod Authorized_keys   

setting. SSH Directory Permissions

chmod 700-r. SSH  

Verify success

[ROOT@CENTOS1. ssh]# ssh centos1 last
login:thu Dec 10:15:52 2015 from 192.168.9.1
Related Article

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.