Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

But:

  • 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 transfered 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?

ps. 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.

share|improve this question
    
This question is definitely one for serverfault.com –  Orbling Jan 21 '11 at 19:10
add comment

migrated from stackoverflow.com Jun 1 '11 at 13:05

This question came from our site for professional and enthusiast programmers.

2 Answers

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

share|improve this answer
    
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 Jan 21 '11 at 16:01
add comment

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.

share|improve this answer
    
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 Jan 21 '11 at 22:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.