Configure SSH password-free logon in CentOS 6.5

Source: Internet
Author: User

Configure SSH password-free logon in CentOS 6.5

Configure SSH password-free logon in CentOS 6.5

Create a new user: useradd Hadoop
Set the password: passwd hadoop. Enter the desired password. Then, su hadoop switches to the user.
Modify the Host Name: vim/etc/sysconfig/network. Add the host name master and log out of the system.
Modify the hosts file: vim/etc/hosts 192.168.56.101 master 192.168.56.102 slave1
Ssh Login-free, view ssh:
[Hadoop @ master ~] $ Rpm-qa | grep ssh
Openssh-server-5.3p1-94.el6.x86_64
Libssh2-1.4.2-1.el6.x86_64
Openssh-clients-5.3p1-94.el6.x86_64
Openssh-5.3p1-94.el6.x86_64
Openssh-askpass-5.3p1-94.el6.x86_64
I have installed all of them. If not, use yum install ssh (which is missing)
Modify/etc/ssh/sshd_config RSAAuthentication yesPubkeyAuthentication yesAuthorizedKeysFile. ssh/authorized_keys
Enable these three lines, and then restart service sshd restart
Now configure logon without a password [hadoop @ master ~] $ Cd/home/hadoop/
[Hadoop @ master ~] $ Ssh-keygen-t rsa: Press enter [hadoop @ master ~] $ Cd. ssh/
[Hadoop @ master. ssh] $ cp id_rsa.pub authorized_keys
[Hadoop @ master. ssh] $ chmod 600 authorized_keys
Copy authorized_keys to another machine without password [hadoop @ master ~] $ Scp authorized_keys root@192.168.56.102:/home/hadoop/. ssh should pass with root privileges, otherwise errors will occur

Set the. ssh directory permission chmod 700-R. ssh
If you want to log on to every machine without a password, add the key generated by each machine sub-account to the file (this is executed on the controlled machine Sub-Account)
Cat id_rsa.pub>. ssh/authorized_keys
 

Now you can log on to slave1 from the master without having to log on to the master from slave1, you also need to execute scp authorized_keys root@192.168.56.101 on slave1:/home/hadoop /. run cat id_rsa.pub>. ssh/authorized_keys
In this way, you can log on from the master to slave1, or from slave1 to the master without a password.


For example, the interface after my configuration is successful is as follows: [hadoop @ master ~] $ Clear
[Hadoop @ master ~] $ Ssh slave1
Last login: Mon Nov 3 13:33:02 2014 from 192.168.56.101
[Hadoop @ slave1 ~] $ Ssh master
Last login: Mon Nov 3 13:33:06 2014 from 192.168.56.102
[Hadoop @ master ~] $

If a logon failure occurs: I use centos 6.5 and centos6.5 for strict network management. I need to disable selinux on the basis of the original settings and go to/etc/selinux/config, change SELINUX = enforcing to SELINUX = disabled, restart the machine, and OK.

SSH password-free login configuration in CentOS 6.0

How to Improve the SSH login authentication speed of Ubuntu

Enable the SSH service to allow Android phones to remotely access Ubuntu 14.04

How to add dual authentication for SSH in Linux

Configure the SFTP environment for non-SSH users in Linux

Configure and manage the SSH service on Linux

Basic SSH tutorial

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.