Centos6.5 configure SSH password-free login and centos6.5ssh password-free Login

Source: Internet
Author: User

Centos6.5 configure SSH password-free login and centos6.5ssh password-free Login

  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. [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)
    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
      [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
    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 root@192.168.56.101:/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::
    [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 ~] $

  7. 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.

How to configure ssh password-less login in ubuntu?

There is no space between ssh and-keygen.
Ssh-keygen is used to generate key pairs.
Command:
Ssh-keygen-t dsa-f ~ /. Ssh/id_dsa
After you press enter, you will be prompted to enter the passphrase password, just skip it.

After completion ~ Two new files are generated under the/. ssh/directory, instead of folders.
Id-dsa # Private Key
Id_dsa.pub # public suffix, public Key

Also, your-p command may be confusing.
Man ssh-keygen

-P phrase Provide old passphrase. # The parameter followed by-P is the old password set previously.
-P Change passphrase of private key file. #-p, lowercase p, without parameters, indicates that you want to Change the password

In fact, the ssh section of laruence's private kitchen is very detailed. You can refer to it for details.

I will share with you the process I tried:

# Set key verification

1. Generate a local public key and private key pair
2. Modify the Private Key Permission to 600, which can only be accessed by myself.
3. Upload the public key to the server
4. append the public key content to the/. ssh/authorized_keys file in the home directory of the remote host.
Change authorized_keys to 600
Delete the uploaded public key.

5. Import the new key pair in the local key ring.

The command is as follows:
1.
Ssh-keygen-t rsa
# Enter passphraze in the middle. Do not enter passphraze. enter directly to the end.
Result: a key pair is generated.
Your identification has been saved in/home/Lynn/. ssh/id_rsa.
Your public key has been saved in/home/Lynn/. ssh/id_rsa.pub.

2.
Chmod 600/home/Lynn/. ssh/id_rsa

3.
Cd ~ /. Ssh
Sftp Capricorn@192.168.1.100
Sftp> put id_rsa.pub
Exit

4.
Ssh Capricorn@192.168.1.100
Cat id_rsa.pub>./. ssh/authorized_keys
Chmod 600./. ssh/authorized_keys
Rm id_rsa.pub
Exit

5. # The new private key generated by keygen imported by the client
# Ssh-add-adds private key identities to the authentication agent

Ssh-add

Finished .... Remaining full text>

After centos62 is installed, the ssh service can also be used, but the sample configuration starts the ssh service when the user name and password are not entered in character mode.

In character mode, no user name or password is required. The ssh service is enabled by default.

And it does start to enter the startup program before entering the user name and password.
See the configuration file/etc/initab.

Your system may be slow.

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.