免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1030 | 回复: 0
打印 上一主题 下一主题

Linux系统分发scp不需要输入密码配置 [复制链接]

论坛徽章:
1
15-16赛季CBA联赛之北控
日期:2022-03-04 22:35:50
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-05 16:27 |只看该作者 |倒序浏览

作者: onquer  出自: http://www.linuxdiyf.com
首先在每个节点执行一下命令脚本
mkdir -p ~/.ssh
chmod 700 ~/.ssh
/usr/bin/ssh-keygen -t rsa
然后再需要批量分发的主机上
touch ~/.ssh/authorized_keys
ssh 192.168.1.20 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
说明:192.168.1.20是分发主机的IP地址
The authenticity of host 'linux1 (192.168.1.100)' can't be established.
RSA key fingerprint is 2f:cc:a1:4f:2b:67:01:6a:d1:9e:0b:ab:c8:9e:57:a1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'linux1,192.168.1.100' (RSA) to the list of known hosts.
oracle@linux1's password: xxxxx
在需要分发的主机执行
chmod 600 ~/.ssh/authorized_keys
在分发主机验证
ssh 192.168.1.19 hostname
RS9
在分发主机上常见 scp.sh 文件
从分发主机192.168.1.20向 192.168.1.19、192.168.1.10 分发文件
scp -r /usr/local/adsit/webapps/preroll/WEB-INF/classes
root@192.168.1.19
:/home/adsit/
scp -r /usr/local/adsit/webapps/preroll/WEB-INF/classes
root@192.168.1.10
:/home/adsit/
在分发主机执行 scp.sh 实现拷贝功能。

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/31/showart_673843.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP