Linux服务器配置双机信任

目的

Linux服务器配置双机信任

环境

服务器1的IP:192.168.1.1

服务器2的IP:192.168.1.2

在两台服务器上都按照以下步骤操作

# 创建公钥和密钥(敲完后按3次回车)

ssh-keygen -t rsa

# 将自己的公钥追加到认证公钥

cat ~/.ssh/id_rsa.pub >> authorized_keys在服务器1上操作

# 将服务器2的公钥追加到认证公钥

ssh 192.168.1.2 cat ~/.ssh/id_rsa.pub >> authorized_keys在服务器2上操作

# 将服务器1的公钥追加到认证公钥

ssh 192.168.1.1 cat ~/.ssh/id_rsa.pub >> authorized_keys测试

# 在服务器1上执行下面的命令,如果配置正确的话就无需输入密码也能显示服务器2的网卡信息

ssh 192.168.1.2 ifconfig

猜你喜欢

转载自www.linuxidc.com/Linux/2016-03/129011.htm