生成密钥拷贝到远程电脑命令ssh-copy-id root@远程电脑ip 失败,出现了:/etc/ssh/ssh_config line 52: Unsupported option “rsaauthentication” /etc/ssh/ssh_config: line54: Bad configuration option: permitrootlogin /etc/ssh/ssh_config:terminating, 1 bad configuration options
解决方案:vim /etc/ssh/ssh_config
修改一下下面两个设置就可以了
#RSAAuthentication yes #PermitRootLogin yes
另外我在/etc/ssh/sshd_config修改了:
PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys免密ssh的过程
我是为了搭建hadoop集群,才搞的这个免密登录,机器准备
- 操作系统
配置两台机器:ubuntu18.04, Centos 7.x ,ip 设置: 192.168.31.9
192.168.31.10
两台机器的/etc/hosts文件都设置了别名,分别如下:
192.168.31.9 hj 192.168.31.10 xj
- 生成密钥
ssh-keygen -t rsa 然后一直按enter
cd /root/.ssh就可以看到两个文件了:id_rsa,id_rsa.pub
- authorized_keys:存放远程免密登录的公钥,主要通过这个文件记录多台机器的公钥(初始不存在该文件) *
- id_rsa : 生成的私钥文件 *
- id_rsa.pub : 生成的公钥文件*
- know_hosts : 已知的主机公钥清单*(初始也不产生)
直接命令:
在/root/.ssh文件夹下: ssh-copy-id root@对方的Ip 在31.10机器上: ssh-copy-id root@192.168.31.9 在31.9机器上: ssh-copy-id root@192.168.31.10 也可以: 如果在hj/31.9的话 ssh-copy-id xj 如果在xj/31.10的话 ssh-copy-id hj
参考:
https://blog.csdn.net/u013415591/article/details/81943189



