Results 1 to 3 of 3
Hi
This question isn't directly SuSE based, I just post it here since I'm most familiar with SuSE.
In short I want to tranfer files between two remote linux machines, ...
- 06-06-2009 #1Just Joined!
- Join Date
- Dec 2007
- Posts
- 5
how to transfer files between two remote servers
Hi
This question isn't directly SuSE based, I just post it here since I'm most familiar with SuSE.
In short I want to tranfer files between two remote linux machines, running a command on a third machine.
My situation is this:
There are three machines involved:
SERVER1: This machine accepts either sftp or scp file transfers.
SERVER2: I control this server, so it accepts pretty much anything I want it to accept. Sftp, scp, rsync, ftps... you name it. Anything that's safe to have open to the internet.
WORK: This is a remote machine at my workplace that's runnin SunOS 5.9 (Solaris 9). I have very limited access to this machine. I can ssh into it, but can't install any programs.
The main problem is that SERVER1 and SERVER2 can't talk together. But WORK can talk to both of them. So what I need to do is ssh into WORK, and use that computer to transfer data between SERVER1 and SERVER2. It would be perfect to use rsync for this, but for some reason rsync doesn't work on the WORK server. Does anyone know how I could do this? Any nice scripts or tools out there that I could use for this project, that maybe utilize sftp or scp?
Btw I found a promising script here: xtravar.net/article.php?id=14 , that I might maybe have used and changed. But unfortunately WORK doesn't have php installed.
Now I know that it would be logical to talk to my admin at work and ask him to set something up, but I'd rather want to do this just by myself. He's not that friendly actually and would take ages to find the time to help me out
Regards
Frímann Kjerúlf
- 06-13-2009 #2Linux Enthusiast
- Join Date
- Apr 2004
- Location
- UK
- Posts
- 658
You could use port forwarding to achieve what you want.
The first command will open a ssh connection from SERVER2 to WORK and also open a port on SERVER2. Anything sent to SERVER2 on port 2222 will get sent to WORK and the forwarded (in the clear) to SERVER1.Code:ssh -L 2222:SERVER1:22 WORK ssh localhost -p 2222
The second command uses that connection to ssh from SERVER2 to SERVER1 via WORK, with the second ssh session protecting the clear channel between WORK and SERVER1.
You should be able to do whatever you want with this afterwards. SFTP should work immediately, rsync would require adjusting the first command so the connection is to the rsync port rather than the ssh port.
Let us know how you get on.To be good, you must first be bad. "Newbie" is a rank, not a slight.
- 06-14-2009 #3Just Joined!
- Join Date
- Dec 2007
- Posts
- 5
I'we tried setting up a SSH tunnel, but it seems that the WORK server has tunneling dissabled. I get a message telling me it has been disabled by the administrator.
Rsync is the best solution for this. But the rsync port was blocked on the WORK server, so the solution was to use port 22 for rsync. For example:
rsync -avP --rsh='ssh -p22' SERVER1:directory SERVER2:directory
Here SERVER1 and SERVER2 have been defined in ~/.ssh/config. This command does exactly the same thing:
rsync -avP --rsh='ssh -p22' username@ip-of-SERVER1:directory username@ip-of-SERVER2:directory
Here we are using port 22 for rsync.


Reply With Quote