
第一次登录Linux主机的时候会询问是否下载密钥:
The authenticity of host '10.19.194.47 (10.19.194.47)' can't be established.
RSA key fingerprint is 23:9d:87:92:3a:18:cc:a1:7a:5b:9e:91:d6:56:cd:b1.
Are you sure you want to continue connecting (yes/no)?
当输入yes后,以后登录就不会再次出现,请问怎么让他第一次也不出现?就是默认为yes。
1、ssh-keygen是个创建密钥对命令例如ssh-keygen -t rsa会在 /root/.ssh/生成id_rsa和id_rsa.pub
2、~代表用户HOME路径
3、scp是个复制命令,注意命令和参数之间的空格
例如scp /root/.ssh/id_rsa.pub root@192.168.3.11:/opt
4、为了无密码访问,需要登录到192.168.3.11,将刚才的id_rsa.pub添加到到/root/.ssh/authorized_keys文件
例如cat /opt/id_rsa.pub >>/root/.ssh/authorized_keys
报错提示, 主机名不能解析,请用ip 进行拷贝,或者,把方法一: 用ip 地址:
ssh-copy-id –i /root/.ssh/id_rsa.pub root@ipaddress
方法二: 主机名写本地hosts 解析
echo "nodeserverIP地址 nodeserver" >>/etc/hosts
ssh-copy-id –i /root/.ssh/id_rsa.pub root@nodeserver
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)