LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-04-2008, 04:19 PM   #1
atulsvasu
Member
 
Registered: Apr 2006
Distribution: Gentoo
Posts: 49

Rep: Reputation: 15
Scp across two disconnected servers


Hi

I've three machines connected

M1 ---- M2 ---- M3

M1 can't access M3 or viceversa. (security issues)

So I'm sitting on M2 and want to issue something like

scp M1:~/file1 M3:~/

But unfortunately ssh goes to machine M1 to do scp to M3, which
is not valid.

However if I do
scp M1:~/file1 /tmp/
scp /tmp/file1 M3:~/

everything is fine, probably I am simply ignorant, is there a nice way to ask ssh to not assume ssh client on the source machine?

There are other two solutions I know of
a) Use nc to cat the file over network, and let ssh carry it securely.
b) Use sshfs, to do the second copy instead of actually maintaining a local copy.

But the nice thing would be an argument to scp that makes it possible, (and I believe there must be one) that does something like (a) or better.

Regards.
 
Old 05-05-2008, 12:00 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
The tunnel config examples in http://souptonuts.sourceforge.net/sshtips.htm could help.
 
Old 05-06-2008, 12:28 AM   #3
atulsvasu
Member
 
Registered: Apr 2006
Distribution: Gentoo
Posts: 49

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by unSpawn View Post
The tunnel config examples in http://souptonuts.sourceforge.net/sshtips.htm could help.
I don't want to compensate security on these machines either by opening new ports
 
Old 05-06-2008, 07:10 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by atulsvasu View Post
I don't want to compensate security on these machines either by opening new ports
Any more requirements you forgot to post?
 
Old 05-07-2008, 01:45 AM   #5
atulsvasu
Member
 
Registered: Apr 2006
Distribution: Gentoo
Posts: 49

Original Poster
Rep: Reputation: 15
Thanks for pointing the links, I am aware of most of the ways in which these are handled. In my case machine M2 should be doing all the scripting. M1 and M3 shall expose only ssh to M2, and only to M2 and other trusted machines.

So sitting in M2 it should be able to send file from M1 to M3.

It would have been nice if we can do something like (which doesn't work)

mkfifo temp
scp M1:file ./temp &
scp ./temp M3:file

But scp needs a proper file not a fifo.

nc would have worked nice if M1/M3 had nc installed which is not the case.

In fact M1 and M3 has only ssh (which can be run with my privileges)

-Atul
 
Old 05-07-2008, 01:50 AM   #6
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
How much is M2 trusted? Can it be trusted to hold a private ssh identity allowed to ssh to M1/M3 without password? If yes, you can use
Code:
 
  ssh M1 cat file | ssh M3 cat >file
Well, it works for me somehow reasonably even if I do have to type some passwords, but your mileage may vary.
 
Old 05-07-2008, 04:22 AM   #7
atulsvasu
Member
 
Registered: Apr 2006
Distribution: Gentoo
Posts: 49

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by raskin View Post
How much is M2 trusted? Can it be trusted to hold a private ssh identity allowed to ssh to M1/M3 without password? If yes, you can use
Code:
 
  ssh M1 cat file | ssh M3 cat >file
Well, it works for me somehow reasonably even if I do have to type some passwords, but your mileage may vary.
Excellent! But it still needs cat on machine M1, which I've to check.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-28-2008 11:41 PM
Doing backup of servers scripts using tar/gzip/scp/rm Swakoo Linux - General 4 12-05-2006 02:09 AM
SCP copying directories between servers astrollama Linux - Software 5 10-13-2006 03:10 AM
Using scp to copy files between servers. muskiediver Linux - General 1 07-11-2006 03:52 PM
Always get disconnected J_Szucs Linux - Newbie 6 03-18-2002 06:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration