gpt4 book ai didi

xml - 如何使用 curl 从 sftp 服务器下载文件

转载 作者:行者123 更新时间:2023-12-02 15:33:50 29 4
gpt4 key购买 nike

我需要为 SFTP 服务器 下载 .xml 文件。当我使用命令时 sftp://username:password@%ipaddress/ram//abc.xml....它正在工作。

要求是为多个 IP 地址下载。我尝试将它与 curl 一起使用,通过命令下载curl -f -m 600 -o temp.xml sftp://username:password2%1/ram/abc.xml%1是一个包含多个IP地址的文本文件。

但它不起作用....有人可以建议更改命令...谢谢

最佳答案

您可以使用 SFTPSSH 服务器安全地抓取文件:

curl -u username sftp://server1.cyberciti.biz/path/to/file.txt

或者(注意 ~ 表示你的 $HOME)

curl -u vivek sftp://home1.cyberciti.biz/~/docs/resume.pdf

您可以使用 SCPSSH 服务器获取文件,并使用 private key 进行身份验证。
语法是:

curl -u username: --key ~/.ssh/id_rsa --pubkey ~/.ssh/id_rsa.pub scp://home1.cyberciti.biz/~/Videos/rhn_register.ogv

在哪里,

`-u username` - Specify the user name (and optional password) to use for server authentication.
`-u username:password` - Specify the user name (and optional password) to use for server authentication.
`--key ~/.ssh/id_rsa` - SSL or SSH private key file name. Allows you to provide your private key in this separate file.
`--pubkey ~/.ssh/id_rsa.pub` - SSH Public key file name. Allows you to provide your public key in this separate file.
scp://home1.cyberciti.biz/~/Videos/rhn_register.ogv - Use scp protocol and download file from my home server called home1.cyberciti.biz.

关于xml - 如何使用 curl 从 sftp 服务器下载文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21404181/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com