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
Hi
You just need to create a ssh tunnel to SERVER2, have a look here;
<http://souptonuts.sourceforge.net/sshtips.htm>
In the example think of linux laptop (SERVER1), SSH Server (WORK) and
HTTP Server (SERVER2).
–
Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.2 Milestone 2 (i586) Kernel 2.6.30-rc6-git3-4-default
up 20:34, 2 users, load average: 0.18, 0.31, 0.24
CPU VIA Esther processor 1000MHz GPU VIA CX700/VX700
Exactly. The approximate commands would be the following to transfer a
file from server1 (named file1 in your home directory) to yourServer2User
(again to the home directory) on the remote machine after SSH-ing into
your work computer as yourWorkUser:
#Open another shell
SERVER1:~> scp $HOME/yourFile yourServer2User@localhost: -P 2222
Keep in mind that ‘SERVER2’ above is either an IP or DNS name resolvable
from WORK that resolves to SERVER2 and is not an IP or DNS name that must
work from SERVER1. Tunnels are beautiful things.
Good luck.
Malcolm wrote:
>
> Hi
> You just need to create a ssh tunnel to SERVER2, have a look here;
> <http://souptonuts.sourceforge.net/sshtips.htm>
> In the example think of linux laptop (SERVER1), SSH Server (WORK) and
> HTTP Server (SERVER2).
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
malcolmlewis: Thanks for your answer, but the problem is that SERVER1 and SERVER2 can’t talk together. But they can both talk to WORK, so the transfer would have to go through WORK. I think SERVER1 is connected to the same network as WORK through vpn.
dreamspy wrote:
> malcolmlewis;1996187 Wrote:
>> Hi
>> On the home machine, open either nautilus and use sftp://…server1
>> or
>> if konq use fish://…server1 and see if that works.
>>
>> –
>> Cheers Malcolm °¿° (Linux Counter #276890)
>> openSUSE 11.2 Milestone 2 (i586) Kernel 2.6.30-rc6-git3-4-default
>> up 11:12, 2 users, load average: 0.02, 0.07, 0.08
>> CPU VIA Esther processor 1000MHz GPU VIA CX700/VX700
>
>
> One thing I’m confused about though. Shouldn’t I put
> sftp://localhost:22000 in konq? 22000 is the port that I set to forward
> in .ssh/config
>
> Just to make sure
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
I managed to find a simple solution to this. I used rsync from the WORK server to sync a directory on SERVER1 to a directory on SERVER2. The trick was to use an alternative port for rsync, and not the default port. The command looks something like this:
Here SERVER1 and SERVER2 have been defined in ~/.ssh/config like descriped in the tutorial mentioned earlier. This command does exactly the same thing:
I was actually syncing the contents of SERVER1 to a local directory.
It seems that I’m almost back to square one here
I’we also tried to copy straight between SERVER1 and SERVER2 using scp:
scp SERVER1:file SERVER2:.
But I get the message:
Host key verification failed.
lost connection
Which is very strange since I can copy local files both to SERVER1 and SERVER2 without problems, f.x. like this:
scp localfile SERVER1:.
scp localfile SERVER2:.
So the only possibility I see it to write some sort of script to do this. A script that runs on WORK and copies files from SERVER1 to a local directory on WORK, and then copies them to SERVER2.
The biggeset problem with this is my harddrive limitation on the WORK server, which is around 1-2 GB’s I think. Is there any possibility to copy only part of files using scp or sftp?
Also if anyone has any better suggestins I’m all ears
Although all the servers can ssh into each other without trouble
I even tried deleting all the known_hosts and authorized_keys files on all the servers. When I did that I was asked for the password for source_server, and then I got the same message as before. So scp doesn’t even try to connect to dest_server. I’m confused here. Anyone have a clue?