Establish trust relationships between openssh hosts
Source: Internet
Author: User
Establish a trust relationship between openssh hosts-Linux Enterprise Application-Linux server application information. The following is a detailed description. This time, we tried to use openssh to Establish a trust relationship between hosts on two linux Hosts and use the rsa key generated by ssh-keygen for authentication to directly log on to the host, you do not need to provide an access password. This method is simple and secure and convenient. We will introduce how to use key authentication to allow SecureCRT to directly log on to the remote openssh host, so that password authentication can be discarded to improve the remote login security of linux Hosts.
The following describes how to establish a host trust relationship between two linux Hosts. For more information, see.
1. Configure the client first.
Client definition: If we log on to server B from server A without A password, then A is the client, and B is the server. In our example, 192.168.13.128 is the client and 192.168.13.129 is the server.
Log on to 192.168.13.128 as root and perform the following operations:
# Cd/root/. ssh
# Ssh-genkey-t rsa-B 1024
Generates a public/private key rsa pair.
The default private key is id_rsa and the Public Key is id_rsa.pub.
In this way, two files, id_rsa and id_rsa.pub, are generated under the/root/. ssh directory. Perform the following operations:
Mv id_rsa identification
Then modify the ssh configuration file/etc/ssh/ssh_config
Locate the IdentifyFile line in the configuration file and change it to "IdentityFile ~ /. Ssh/identification"
This means that the specified private key file is used for authentication.
Then, we will put the pub key scp to the server 192.168.88.6:
Scp id_rsa.pub 192.168.13.129:/root/. ssh/
In this way, the client configuration is fine.
2. Let's Configure the server.
Cd/root/. ssh
Mv id_rsa.pub authorized_keys
Then Configure/etc/ssh/sshd_config to enable the rsa Authentication Mode:
RSAAuthentication yes
AuthorizedKeysFile % h/. ssh/authorized_keys
Then Restart sshd.
#/Etc/init. d/ssh restart
3. OK. We can try to log on to the server from the client.
You can log on directly without password verification.
The above only configures the root user's trust relationship
If the client account is laiwei @ debian
The server account is laiwei2 @ debian2.
If laiwei On debian needs to establish a trust relationship with laiwei2 On debian 2, you must also repeat the preceding steps:
1. log on to the client with laiwei:
$ Cd ~ /. Ssh
$ Ssh-keygen-t rsa-B 1024
Will be in the current directory (~ /. Ssh) the following two files are generated: id_rsa and id_rsa.pub.
$ Mv id_rsa identification
$ Scp id_rsa.pub laiwei @ debian2 :~ /. Ssh/
OK. The client has been configured.
2. Configure debian2 on the server side
Log on to debian2 with laiwei2
$ Cd ~ /. Ssh
Rename id_rsa.pub from debian copy in this directory
Mv id_rsa.pub authorized_keys
Restart sshd
You can log on to laiwei2 @ debian2 without using the password from laiwei @ debian ssh.
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