Centos6 password-free login between servers

Source: Internet
Author: User
I received a request today to activate six servers for password-free login between servers.

Unified configuration of all servers: 1-3

1. Modify the hosts file and write the hostname and IP address of all servers to/etc/hosts.
10.1.1.1 ip-10-1-1-1
10.1.1.2 ip-10-1-1-2

2. Modify/etc/ssh/sshd_conf
#> VI/etc/ssh/sshd_config
??????? Find the following content and remove the annotator "#"
Rsaauthentication Yes
Pubkeyauthentication Yes
Authorizedkeysfile? ? ?. SSH/authorized_keys
?????? Restart the SSH service
? #> Service sshd restart

3. Disable SELinux and change SELinux = to disabled #> CAT/etc/SELinux/config

SELinux = disabled
Selinuxtype = targeted

Key File Processing: A (10.1.1.1) password-free logon B (10.1.1.2)
The following operations must be performed under the user who wants to log on without password.
1. Operate on server:
Generate the key file and distribute the concurrent Public Key to the logged-on server:
$> Ssh-keygen-T RSA
Press enter all the way without entering anything
Two key files are generated.
$> LL/home/dmadmin/. Ssh/
Authorized_keys ----------- the key file that the SSH service will find. The archive file is the lock file,
Id_rsa ----------- this is the private key file, which is required by server.
Id_rsa.pub ----------- this is a public key file (LOCK) and needs to be written to authorized_keys of server B.
$> CAT ~ /. Ssh/id_rsa.pub>/home/dmadmin/. Ssh/authorized_keys
$> Chmod 400/home/dmadmin/. Ssh/authorized_keys
$> Ssh-copy-ID-I. Ssh/id_rsa.pub [email protected] transfers the lock file to the logged-on server.

2. Operate on server B
Log on to the server to be logged on and modify the key file permissions.
$> Chmod 400/home/dmadmin/. Ssh/authorized_keys

3. Go back to server a to Test password-free Logon: you can connect to the computer name or IP address.
A ~ $> SSH 10.1.1.2
A ~ $> SSH ip-10-1-1-2
No Password is required. server a can directly log on to server B.

--------------------------------------------------------------------- Server B password-free login to server a 1. at that time, server a had put the public key file in ITS/home/dmadmin /. in the ssh/authorized_keys file, you only need to copy the lock to the local/home/dmadmin /. SSH/directory. 2. Copy the key to server B/home/dmadmin/. Ssh/use the SCP command on server a to copy the private key file to server B. A ~ $> SCP/home/dmadmin /. SSH/id_rsa [email protected]:/tmp/on server B, use the MV command to copy the file to/home/dmadmin /. SSH/B ~ $> MV/tmp/ia_rsa/home/dmadmin/. Ssh/3. Server B password-free logon to server A: you can connect to the computer name or IP address B ~ $> SSH 10.1.1.1 B ~ $> SSH ip-10-1-1-1

Centos6 password-free login between servers

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.