Set password-free logon for ssh and password-free logon for ssh

Source: Internet
Author: User

Set password-free logon for ssh and password-free logon for ssh

Hypothesis:

-> Host A of the operating machine must log on to machine B and machine C without A password as user1?

User user1 is created on machine B and machine C and can be logged on through ssh.


Machine A settings:

1. Install the ssh service. Here

2. # ssh-keygen-t rsa-p''

Auto generate ~ /. Ssh/id_rsa and ~ /. Ssh/id_rsa.pub files.

Machine B and machine C settings:

1. Install the ssh service. Here

2. Modify/etc/ssh/sshd_config to find the ssh configuration file, and enable PubkeyAuthentication yes.

3. append the id_rsa.pub file generated on server A to the user1/. ssh/authorized_keys file on server B and server C. If the file is not manually created, you can use it.


The preceding settings for machine B and machine C can also be performed on machine A as follows:

Ssh-copy-id-I ~ /. Ssh/id_rsa.pub user1 @ ip address of server B


Restart the sshd service.

A password-free logon to machine B:

Ssh user1 @ B press Enter.

C is the same as above.


Related unsuccessful logs:/var/log/secure of machine B or machine C




Ssh password-free settings

Set the. ssh directory to 700 and have the execution permission.
Set authorized_keys to 600. Otherwise, an error occurs.
For example
Ssh root @ localhost

Ssh does not require a logon password. How can I configure it?

Here is an example:
192.168.1.1 --- client
192.168.1.2 --- slave

First on 192.168.1.1
Ssh-keygen
Generate id_rsa id_rsa.pub
Copy the content in id_rsa.pub
Create the authorized_keys file in the/root/. ssh/directory of 192.168.1.2
Copy the content in id_rsa.pub of 192.168.1.1 to the authorized_keys file.

Then execute ssh-keygen on 1.2.
Copy the content in id_rsa.pub to/root/. ssh/authorized_keys at 192.168.1.1.

Now you can try it!

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.