In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Use key to connect to the remote host based on Xshell, the details are as follows
In terms of authentication, there are generally two ways to connect to a remote host, one is through the user password, and the other is through the public key (Public Key).
Figure 1. Xshell supports ways to authenticate logged-in users
Let's use Public Key to implement the connection and generate the key pair through the tool ssh-kengen.
Note: ping is required to communicate with the local machine and the destination host before operation (if the ping is not available, it may be because the firewall, SELinux is not turned off, or there is a problem with the gateway setting, etc.)
Using XShell, XShell manager 5 is used here, the destination host is CentOS6, and the remote host that needs to connect is called the destination host.
The destination host installs the ssh server and opens it
[root@node1 ~] $yum install-y openssh-server # install openssh server [root@node1 ~] $yum install-y openssh-clients # install openssh client, do not install [root@node1 ~] $service sshd start # temporarily open sshd service [root@node1 ~] $chkconfig sshd on # permanently open sshd service Server restart also takes effect [root@node1 ~] $service sshd status # View sshd service running status openssh-daemon (pid 1384) is running. # shows it is running
Generate ssh key pairs (including private and public keys)
[root@node1 ~] $(umask 0077) Ssh-keygen) # generate ssh key pair And set the permission to 600Generating public/private rsa key pair.Enter file in which to save the key (/ root/.ssh/id_rsa): # enter Enter passphrase (empty for no passphrase): Enter same passphrase again: 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:fd:72:10:50:a6:7d:83:c7:93:d2:26:3d:12: 0e:38:2f root@node1The key's randomart image is:+-- [RSA 2048]-+ | .o. + | | o B *. | | o. O% | | E. O + | | .o | | o | |. O | | o | | +-+ [root@node1 ~] $cd .ssh / [root@node1 .ssh] $ll # View key / public key pair information. 1 root root 1675 May 21 14:26 id_rsa # Private key-rw-. 1 root root 392 May 21 14:26 id_rsa.pub # Public key [root@node1 .ssh] $
Modify the sshd connection profile vim / etc/ssh/sshd_config
PasswordAuthentication no # does not allow password authentication login PubkeyAuthentication yes # allows public key authentication login AuthorizedKeysFile .ssh / id_rsa.pub # specify public key file path
Export the ssh key pair to the local machine. It is recommended to create a directory dedicated key pair.
#] sz id_rsa#] sz id_rsa.pub
Reload sshd service
[root@node1 .ssh] $service sshd reload reload sshd: [OK]
Connect using XShell
Ssh root@IP
Figure 2. Select key file
Figure 3. Import the private key and determine
Note: reconnect again after clicking OK
Figure 4. Successful connection
The client uses the private key for authentication, while the remote host uses the public key for authentication.
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
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.