通过SFTP / SSH接收文件并自动转发到另一台服务器上的FTP [英] Receive File via SFTP/SSH and automatically forward to FTP on another server

查看:759
本文介绍了通过SFTP / SSH接收文件并自动转发到另一台服务器上的FTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在通过FTP从客户端收到平面文件。一些客户坚持需要使用SSH私钥SFTP而不是普通的FTP。



我想要做的是设置一个web服务器(最好在linux / unix,但我想我可以在Windows服务器上购买并购买SFTP服务器软件),它将执行以下操作:


  1. 允许我使用唯一的用户/密码为每个客户端设置一个SFTP目录。每个目录还必须有公钥/私钥SSH东西,我对这个有点新,但是我已经使用了它。

  2. 文件完全由客户端上传,我想通过普通FTP将该文件的ftp文件启动到我的Windows云中。 这些文件可以启动到10mb,所以即使这个FTP到另一台服务器也无法启动,直到文件完全上传。 任何人设置这样的事情?任何指导将不胜感激。



    谢谢!

    解决方案

    ,您可以使用 incron 来监控文件的目录SFTP'd,并让它触发你的FTP作业。它有点像cron,只是基于文件系统修改而不是基于时间触发作业。为了只在整个文件被写入时才触发,我认为你可以在inotify掩码中使用IN_CLOSE_WRITE。如果没有这个,我建议为每个事件单独配置事件,以便将消息回显到日志文件,并查看是否可以确定仅在SFTP传输结束时才可靠发生的事件。



    如果您使用RedHat,它不在标准发行版中,但它位于 EPEL


    I'm currently in a situation where I receive flat files via FTP from my clients. A couple of clients have insisted on the need to use SSH Private Key SFTP rather than regular FTP.

    What I want to do is setup a web server (preferably in linux/unix but I guess I can do it on a windows server and purchase SFTP server software) that will do the following:

    1. Allow me to setup an SFTP directory for each client with unique user/pass. Each directory also has to have the public/private key SSH "stuff" I'm a little new to this but I've googled it.

    2. Once the file is completely uploaded by the client, I want to kick off an event that ftp's that file via regular FTP to my Windows cloud.

    3. These files can be up to 10mb so the even that ftp's to the other server can't fire until the file is completely uploaded.

    Has anyone set something like this up? Any guidance would be appreciated.

    Thanks!

    解决方案

    In Linux, you can use incron to monitor the directory the files will be SFTP'd to and have it trigger your ftp job. It's kind of like cron except that instead of triggering jobs based on time, it does so based on filesystem modifications. In order to only trigger once the entire file has been written, I think you can use IN_CLOSE_WRITE in the inotify mask. Failing this, I suggest configuring events for each of the events individually to echo a message to a log file and see if you can identify one which reliably happens only at the end of the SFTP transfer.

    If you're using RedHat, it's not in the standard distribution, but it is in EPEL.

    这篇关于通过SFTP / SSH接收文件并自动转发到另一台服务器上的FTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆