A puzzle: files being uploaded in realtime by SCP to SERVER1 need to be transferred to SERVER2.


  • SERVER1 doesn't actually have network access to SERVER2 (NAT); however SERVER2 has SSH access to SERVER1
  • SERVER1 and SERVER2 both are running Linux
  • SERVER2 has FTP server running, can ran HTTP server to receive files
  • SFTP server on SERVER2 is not an option
  • Files transferred to SERVER2 need to be deleted from SERVER1 on successful transfer

Preference is to use running FTP server on SERVER2.

Any ideas on simple ways to transfer files from SERVER1 to SERVER2?

FTP over reverse SSH tunnel was ruled out; curl would probably work over reverse SSH tunnel with HTTP server running on SERVER2, but it requires HTTP server which is more work.

  • This question is definitely one for serverfault.com
    – Orbling
    Commented Jan 21, 2011 at 19:10

2 Answers 2


You could run rsync over ssh. Set up ssh keys so you can do it non-interactively (i.e. avoid having to use a password). Use cron to schedule it.

Check out this article. http://www.askapache.com/security/mirror-using-rsync-ssh.html

  • Somehow I always was ignoring rsync. Thanks. It seems to be able to remove copied files from sending side (--remove-source-files). The only thing to find out if it can pick for transfer files "not modified during the last X minutes".
    – hombre
    Commented Jan 21, 2011 at 16:01

If you have SSH access to server1 from server2, it seems simplest to scp them onto server2 from server1. Alternatively, you can set up a file serving mechanism like FTP or HTTP(S) server on server1 and transfer them that way using curl etc on server2.

  • You mean it is possible to run commands like that "find /home/user1 -maxdepth 1 -type f -name "*.tgz" -mmin +5 -print | scp {} user2@SERVER2:" from SERVER2? I am a bit puzzled, as there is no access back from SERVER1 to SERVER2. Or do you mean still setting up reverse SSH tunnel and running them from SERVER1.
    – hombre
    Commented Jan 21, 2011 at 22:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .