使用wget和SFTP获取文件 [英] get files with wget and SFTP
问题描述
大家好...
我有一个脚本每天晚上在linux服务器上运行,该脚本打算使用wget和ftp协议从另一个服务器获取文件.这些文件位于无法通过HTTP访问的文件夹下.
I have a script running every night on a linux server, which intend to get files from another one using wget and ftp protocol. These files are located under a folder that can't be accessed through HTTP.
以下是使用的命令行:
wget --directory-prefix=localFolder ftp://login:password@adress.ip.of.server/path/*
站点访问已更改为SFTP.我想修改脚本以使其能够像以前一样获取文件,但是不能通过SFTP来做到这一点.
The site access has been changed to SFTP. I would like to modify the script to be able to get the files just as it was doing before, but don't manage to do this with SFTP.
我试图使用ssh-keygen生成一个安全密钥,然后将其复制到我要访问的服务器上,但是它没有成功,或者我只是没有成功找到正确的方法. ..
I tried to generate a secure key using ssh-keygen and then copy it to the server I wanted to access, but it didn't make it, or I just don't succeed to find the right way to do it...
感谢您的帮助! :)
推荐答案
要复制密钥,我发现ssh-copy-id user@machine
可以满足您的所有需求.只要您的机器上有钥匙.
To copy keys, I find that ssh-copy-id user@machine
does all you need. As long as you have a key on your machine that is.
在指定scp user@machine:filespec whereto
的地方,我也经常使用scp
(它使用与sftp相同的加密和身份验证机制).
I also use scp
quite a bit, where you specify scp user@machine:filespec whereto
(it is using the same encryption and authentication mechanism as sftp).
希望这会有所帮助.
这篇关于使用wget和SFTP获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!