当前位置: 代码迷 >> 综合 >> mxnet-ssh环境配置
  详细解决方案

mxnet-ssh环境配置

热度:92   发布时间:2024-01-16 09:53:10.0

一、环境配置

1、系统:CentOS release 6.4  IP:10.15.133.82  主机名:root

2、系统:CentOS release 7.2  IP:10.15.240.189  主机名:root

 

二、服务器配置

1、在每台服务器上都执行ssh-keygen -t rsa 生成密钥

注意:备份原有的authorized-keys

Generating public/private rsa key pair.
 Enter file in which to save the key (/root/.ssh/id_rsa): #回车代表无需密码登陆
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:
 

2、在每台服务器上将公钥复制到无需登录的服务器上:

 [root@jw01 ~]# cd /root/.ssh
 [root@jw01 .ssh]# ssh-copy-id -i  id_rsa.pub -p 22 root@10.15.240.189

root@10.15.240.189's password:              #输入密码

Now try logging into the machine, with "ssh '-p 22 root@10.15.240.189'", and check in:
 .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
以上信息出现就代表复制成功!

以上,可以自动将公钥添加到authorized_keys的文件中,在每台服务器都执行完以上的步骤就可以实现多台服务器无需密码相互访问了。

 

 

更改密码:passwd

测试ssh登录:ssh 10.15.240.189

 

退出ssh登录:exit

  相关解决方案