Centos6.5 configure SSH password-free Login

Source: Internet
Author: User
  1. Create a new user: Useradd hadoop
  2. Set Password: Passwd hadoop,Enter your desired password, and then su hadoop switches to the user.
  3. Modify host name: Vim/etc/sysconfig/Network: add the hostname master. After logging out of the system, you can see that the modification is successful.
  4. Modify the hosts file: Vim/etc/hosts 192.168.56.101 master 192.168.56.102 slave1
  5. SSH Login-free, View SSH:
    1. [[Email protected] ~] $ 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)
    2. Modify/etc/ssh/sshd_config
      Rsaauthentication yespubkeyauthentication yesauthorizedkeysfile. Ssh/authorized_keys
      Enable these three lines, and then restart service sshd restart
    3. Configure password-free logon now
      [[Email protected] ~] $ CD/home/hadoop/
      [[Email protected] ~] $ Ssh-keygen-t rsa one-way carriage return [[email protected] ~] $ Cd. Ssh/
      [[Email protected]. Ssh] $ CP id_rsa.pub authorized_keys
      [[Email protected]. Ssh] $ chmod 600 authorized_keys
      Copy authorized_keys to another machine without password [[email protected] Master ~] $ SCP authorized_keys [email protected]:/home/hadoop/. Ssh must pass the root permission; otherwise, an error occurs.
    4. Set. Ssh Directory Permissions
      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
    5. Now you can log on to slave1 from the master without logon. If you want to log on to the master from slave1, you also need to execute
      SCP authorized_keys [email protected] 1:/home/hadoop/. Ssh/after the file is copied to the master, run: CAT id_rsa.pub>. Ssh/authorized_keys on the master.
      In this way, you can log on from the master to slave1, or from slave1 to the master without a password.

  6. For example, after the configuration is successful, the interface is as follows::
    [[Email protected] ~] $ Clear
    [[Email protected] ~] $ SSH slave1
    Last login: Mon Nov 3 13:33:02 2014 from 192.168.56.101
    [[Email protected] ~] $ SSH master
    Last login: Mon Nov 3 13:33:06 2014 from 192.168.56.102
    [[Email protected] ~] $

Centos6.5 configure SSH password-free Login

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.