【问题标题】:How to transfer file with SFTP using OpenSSH in SSIS?如何在 SSIS 中使用 OpenSSH 通过 SFTP 传输文件?
【发布时间】:2021-06-07 17:40:10
【问题描述】:

在我的项目中,我必须使用 OpenSSH sftp 工具来使用 SFTP 传输文件,并且它应该从 SSIS 执行。从上个月开始,我进行了很多搜索,但找不到任何解决方案。我确实使用 WinSCP 从 SSIS 传输文件,但客户端现在切换到 OpenSSH。

有人知道如何使用 OpenSSH 传输文件吗?如果有人有任何解决方案,这将是一个很大的帮助。

我正在传输单个文件,我想要上传和下载。我们正在使用私钥进行身份验证。

在 WinSCP 中,我正在执行一个 .bat 文件,该文件将调用一个 .txt 文件,并且 .txt 具有 SFTP put 和 get 命令。

【问题讨论】:

    标签: ssis sftp openssh


    【解决方案1】:

    所以我假设你有一个像这样运行 WinSCP 的批处理文件:

    c:\path\to\winscp.com /script=c:\path\to\script.txt
    

    还有一个 WinSCP 脚本 script.txt 使用私钥对 SFTP 服务器进行身份验证并上传和下载文件:

    open -privatekey=c:\path\to\key.ppk sftp://username@example.com/
    get /remote/path/file.txt c:\local\path\file.txt
    put c:\other\local\path\file2.txt /other/remote/path/file2.txt
    exit
    

    这将转换为OpenSSH sftp,如下所示:

    sftp.exe -b c:\path\to\script.txt -i c:\path\to\key.pem username@example.com
    

    还有一个用于传输文件的sftp 脚本script.txt:

    get /remote/path/file.txt c:\local\path\file.txt
    put c:\other\local\path\file2.txt /other/remote/path/file2.txt
    

    您必须使用PuTTYgen 将您的 WinSCP .ppk 私钥转换为 PEM 格式才能与 OpenSSH 一起使用。


    converting OpenSSH script to WinSCP 有一个指南。虽然这与您想要的完全相反,但通过一些努力,您仍然可以从中挖掘出一些想法。

    【讨论】:

    • 感谢您的回答。我需要提供 sftp.exe 的完整路径吗?喜欢 D:\openSSH\SFTP.exe
    • Windows 10 内置的 Win32-OpenSSH,您不必这样做,因为它的文件夹位于 Windows PATH。
    猜你喜欢
    • 2015-08-04
    • 2013-01-27
    • 1970-01-01
    • 1970-01-01
    • 2016-02-18
    • 2022-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多