Chinaunix

标题: 利用SCP拷贝到其它机器怎么自动输入密码? [打印本页]

作者: sivxy    时间: 2008-01-28 13:35
标题: 利用SCP拷贝到其它机器怎么自动输入密码?
我想写一个Crontab自动拷贝文件到另外一个机器,
想通过SCP来实现,不知道怎么实现自动输入密码?
谢谢~
作者: 7717060    时间: 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 编辑 ]
作者: lysde    时间: 2008-01-28 16:48
作一个公钥,就不需要密码了
作者: 无声无息    时间: 2008-01-28 22:07
因为你已经是可信任主机了,公钥比密码更加难以获取,在需要输入密码已经没有意义了。
正如是你已经是孩子的父亲,就不需要验证你是不是孩子的亲人了。
作者: wuleisky    时间: 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
作者: todaynet    时间: 2008-02-03 03:25
可以写到文件里
作者: very_99    时间: 2008-02-05 10:58
用expect
作者: walkerxk    时间: 2008-02-13 09:33
expect,echo,或者是做公钥,推荐后面那个,如果用前面两个,最好用shc加密一下。
作者: ruoyisiyu    时间: 2008-02-13 15:45
spawn




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2