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

Ssh password-free login

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Ssh password-less login uses public and private keys. Under linux, you can use ssh-keygen to generate public / private key pairs. Let me take redhat 5 as an example.

There are machines A (192.168.122.223) and B (192.168.122.222). Now I want A to log in to B through ssh password-free.

1. Generate a public key / private key pair under machine A.

Add the-P parameter item to indicate the password, and-P''means the empty password, or you don't need the-P parameter, so you have to enter three cars and enter once with-P.

It generates a .ssh directory under / root, with id_rsa and id_rsa.pub under .ssh.

two。 Copy the id_rsa.pub under A machine to B machine, and in the .ssh/authorized_keys file of B machine, I copy it with scp.

Since there is no password-free login, you need to enter a password.

3.B machine adds the id_rsa.pub copied from machine A to the .ssh / authorized_keys file.

The permission of authorized_keys is 600.

4. Machine A logs in to machine B.

Now machine A can log in to machine B without a password.

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)

If you want An and B machines to log in to each other without a password, then B machines can be configured in the same way as above.

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

Network Security

Wechat

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

12
Report