免费注册 查看新帖 |

Chinaunix

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

利用SCP拷贝到其它机器怎么自动输入密码? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-01-28 13:35 |只看该作者 |倒序浏览
我想写一个Crontab自动拷贝文件到另外一个机器,
想通过SCP来实现,不知道怎么实现自动输入密码?
谢谢~

论坛徽章:
0
2 [报告]
发表于 2008-01-28 16:24 |只看该作者
为什么不用nfs和ftp

scp用的也是ssh所以你参考一下
http://blog.chinaunix.net/u1/40306/showart_343138.html 公钥方法

http://bbs.chinaunix.net/thread-15816-1-4.html   shell方法

[ 本帖最后由 7717060 于 2008-1-28 16:52 编辑 ]

论坛徽章:
0
3 [报告]
发表于 2008-01-28 16:48 |只看该作者
作一个公钥,就不需要密码了

论坛徽章:
0
4 [报告]
发表于 2008-01-28 22:07 |只看该作者
因为你已经是可信任主机了,公钥比密码更加难以获取,在需要输入密码已经没有意义了。
正如是你已经是孩子的父亲,就不需要验证你是不是孩子的亲人了。

论坛徽章:
0
5 [报告]
发表于 2008-02-03 03:21 |只看该作者

用rcp不可以吗,man rcp看下,配置个认证ip就直接可以操作了

Examples

In the following examples, the local host is listed in the /etc/hosts.equiv file
at the remote host.

  1. To copy a local file to a remote host, enter:

     rcp localfile host2:/home/eng/jane

     The file localfile from the local host is copied to the remote host host2.
  2. To copy a remote file from one remote host to another remote host, enter:

     rcp host1:/home/eng/jane/newplan host2:/home/eng/mary

     The file /home/eng/jane/newplan is copied from remote host host1 to remote
     host host2.
  3. To send the directory subtree from the local host to a remote host and
     preserve the modification times and modes, enter:

     rcp -p -r report jane@host2:report

     The directory subtree report is copied from the local host to the home

论坛徽章:
0
6 [报告]
发表于 2008-02-03 03:25 |只看该作者
可以写到文件里

论坛徽章:
0
7 [报告]
发表于 2008-02-05 10:58 |只看该作者
用expect

论坛徽章:
0
8 [报告]
发表于 2008-02-13 09:33 |只看该作者
expect,echo,或者是做公钥,推荐后面那个,如果用前面两个,最好用shc加密一下。

论坛徽章:
0
9 [报告]
发表于 2008-02-13 15:45 |只看该作者
spawn
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP