+ -
当前位置:首页 → 问答吧 → 如何实现sftp在脚本中的应用(自动化)?

如何实现sftp在脚本中的应用(自动化)?

时间:2011-12-20

来源:互联网

sftp在使用中需要输入密码,在网上找了很多资料,基本都是说使用ssh-keygen -t rsa生成密钥对,将公钥发送给要访问的系统,并添加到~/.ssh/authorized_keys文件中,就可以了。

但我一直没有实现!请大家帮忙,是不是还需要做什么操作?

作者: fibbery   发布时间: 2011-12-20

很简单的步骤啊,刚才又试了一遍,没问题,你看看这个:
http://hi.baidu.com/toflyintheair/blog/item/932c910b4a5b29e836d122bb.html

作者: askandstudy   发布时间: 2011-12-20


照着做的话很快就设置好了:

试的结果如下:

Assembly code

[root@RHEL6A ~]# ssh rhel6b
Last login: Tue Dec 20 18:57:19 2011 from ad999
[root@RHEL6B ~]# exit
logout
Connection to rhel6b closed.
[root@RHEL6A ~]# ls
anaconda-ks.cfg  dead.letter      eclipse             Public  software
autosrc.sh       Desktop          install.log         pycode  Templates
bin              disable_serv.sh  install.log.syslog  sh1.sh  test2p.tar.gz
ccode            Documents        Music               shcode  Videos
cfgfile          Downloads        Pictures            shexp   workspace
[root@RHEL6A ~]# sftp root@rhel6b
Connecting to rhel6b...
sftp> ls
Desktop                 Documents               Downloads               Music                   
Pictures                Public                  Templates               Videos                  
anaconda-ks.cfg         bin                     disable_serv.sh         install.log             
install.log.syslog      shcode                  
sftp> 

作者: askandstudy   发布时间: 2011-12-20

要注意一下那些命令是在哪台主机上执行的,这个得看清楚

作者: askandstudy   发布时间: 2011-12-20