In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how to configure ssh to log in to remote hosts without entering a password. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Environment:
Local host: ha01
Eth0: 192.168.1.100 / / external IP address
Remote host: ha02
Eth0: 192.168.1.200 / / external IP address
Local host ha01 configuration:
The code is as follows:
[root@ha01 /] # cd / etc/ssh
[root@ha01 ssh] # ssh-keygen-t rsa-N "" (this step generates a key public-private key pair, where-N "" indicates that the key pair phrase is empty)
Generating public/private rsa key pair.
Enter file in which to save the key (/ root/.ssh/id_rsa):
Your identification has been saved in / root/.ssh/id_rsa.
Your public key has been saved in / root/.ssh/id_rsa.pub.
The key fingerprint is:
82:2c:74:43:8e:16:f4:ef:ac:91:0f:d7:6f:a6:f3:59 root@ha01
Copy the public key to the remote host (original method):
If the / root/.ssh/authorized_keys file does not exist on the ha02 server
The code is as follows:
[root@ha01 ssh] # scp / root/.ssh/id_rsa.pub root@192.168.1.200:/root/.ssh/authorized_keys
If the authorized_keys file exists
Execute on ha01:
The code is as follows:
[root@ha01 ssh] # scp / root/.ssh/id_rsa.pub root@192.168.1.200:/root/.ssh/
Execute on ha02:
The code is as follows:
[root@ha02 /] # cat / root/.ssh/id_rsa.pub > > / root/.ssh/authorized_keys
Copy the public key to the remote host (new method):
You can use ssh-copy-id to copy public keys to remote hosts conveniently and securely
Execute on ha01:
The code is as follows:
[root@ha01 ssh] # ssh-copy-id-I ~ / .ssh/id_rsa.pub root@192.168.1.200
SSH login test:
The code is as follows:
[root@ha01 ssh] # ssh ha02
Last login: Fri Apr 8 10:41:28 2011 from ha01
Thank you for reading! This is the end of the article on "how to configure ssh to log on to a remote host without entering a password". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.