Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set ssh password-free login in linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces you how to set ssh password-free login in linux, the content is very detailed, interested friends can refer to, hope to be helpful to you.

1 execute on slave:

The code is as follows:

Ssh-keygen-t rsa or ssh-keygen-t rsa-P''

-P represents the password, and-P''means the empty password, or you can use the-P parameter without the-P parameter, so you have to enter three cars and enter once with-P.

It generates a .ssh directory under the ~ directory, with id_rsa and id_rsa.pub under .ssh.

2 execute the scp remote copy command on slave:

The code is as follows:

Scp / .ssh/id_rsa.pub hadoop@master:~/id_rsa.pub

Since no password-free login has been set at this time, the remote copy needs to enter a password at this time.

The format of the scp command is as follows:

The code is as follows:

Scp local_file remote_username@remote_ip:remote_file)

3 execute on master:

The code is as follows:

Cat ~ / id_rsa.pub > > ~ / .ssh/authorized_keys

Append the public key to the authorized KEY.

4 execute the following command

The code is as follows:

Chmod 600 ~ / .ssh/authorized_keys

The permission of authorized_keys is 600.

At this point, the slave machine can ssh master.

Summary: the login machine can have a private key, and the logged-in machine must have the public key of the login machine. This public / private key pair is usually generated on the private key host. The above is the public / private key pair using the rsa algorithm, of course, you can also use dsa (the corresponding file is id_dsa,id_dsa.pub)

On how to set ssh password-free login in linux to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report