Linux 使用 wget 和 SFTP 获取文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14031773/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 18:06:50  来源:igfitidea点击:

get files with wget and SFTP

linuxwgetsftp

提问by Jeremy Belolo

Hello guys...

大家好...

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.

我有一个每晚都在 linux 服务器上运行的脚本,它打算使用 wget 和 ftp 协议从另一个服务器获取文件。这些文件位于无法通过 HTTP 访问的文件夹下。

Here's the command line used :

这是使用的命令行:

wget --directory-prefix=localFolder ftp://login:[email protected]/path/*

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.

站点访问已更改为 SFTP。我想修改脚本以便能够像以前一样获取文件,但无法使用 SFTP 执行此操作。

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-keygen 生成一个安全密钥,然后将其复制到我想访问的服务器,但它没有成功,或者我只是没有成功找到正确的方法来做到这一点......

Thanks ahead for your help ! :)

提前感谢您的帮助!:)

采纳答案by Mats Petersson

To copy keys, I find that ssh-copy-id user@machinedoes all you need. As long as you have a key on your machine that is.

要复制密钥,我发现这ssh-copy-id user@machine可以满足您的所有需求。只要你的机器上有钥匙。

I also use scpquite a bit, where you specify scp user@machine:filespec whereto(it is using the same encryption and authentication mechanism as sftp).

我也使用了scp很多,您指定的地方scp user@machine:filespec whereto(它使用与 sftp 相同的加密和身份验证机制)。

Hope this helps.

希望这可以帮助。