LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2015, 06:27 PM   #1
LYC
Member
 
Registered: Jan 2014
Posts: 107

Rep: Reputation: Disabled
copy files between servers


Hi,

We have server A, B and C. Files can be copied between A and B as well as B and C but not A and C. This is due to server B has 2 network interface and A and C are in different network segment.

Is there a way to copy files between server A and C directly without changing the network setting?
 
Old 06-22-2015, 06:30 PM   #2
dslackw
Member
 
Registered: Aug 2014
Location: Orestiada, GR
Distribution: Slackware 14.1 x86_64 -stable
Posts: 145

Rep: Reputation: 31
try out ssh
 
Old 06-22-2015, 07:35 PM   #3
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 & 7
Posts: 3,251

Rep: Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887
Can you ping C from A?
 
Old 06-22-2015, 08:38 PM   #4
LYC
Member
 
Registered: Jan 2014
Posts: 107

Original Poster
Rep: Reputation: Disabled
Server A is not able to ping C.
 
Old 06-23-2015, 06:53 AM   #5
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 517
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Quote:
Originally Posted by LYC View Post
This is due to server B has 2 network interface
There's your thing. The only connecting link is B, so the only thing you can do is run some sort of proxy or gateway on B that allows A to connect to the network C is on. Obviously if A and C are on different physical networks then you can't reach one from the other.
 
Old 06-23-2015, 08:38 AM   #6
LYC
Member
 
Registered: Jan 2014
Posts: 107

Original Poster
Rep: Reputation: Disabled
How to run proxy or gateway to achieve the objective?
 
Old 06-23-2015, 08:44 AM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,267

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
this seems related:
http://www.linuxquestions.org/questi...6/#post3804866
 
Old 06-23-2015, 09:35 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,432

Rep: Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108
By using a ssh proxy and I would suggest using keys too.

http://serverfault.com/questions/376...-scp-transfers
 
Old 06-30-2015, 02:45 AM   #9
LYC
Member
 
Registered: Jan 2014
Posts: 107

Original Poster
Rep: Reputation: Disabled
Hi michaelk,

It works by following below in your link:

You can ssh to server B using something like

ssh -L 5022:<server C IP>:22 <user_serverB>@<server B IP>
Then you can ssh to server C using

scp -P 5022 file <user_serverC>@localhost

I want to automate the copying of files between server A and C using cron job but the above method requires 2 separate sessions. Any pointer how to go about it?
 
Old 06-30-2015, 07:01 AM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,432

Rep: Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108
True, that was one method in the link but look again at using the proxycommand option.
 
Old 07-02-2015, 04:45 AM   #11
LYC
Member
 
Registered: Jan 2014
Posts: 107

Original Poster
Rep: Reputation: Disabled
Hi,

I managed to google and found the following way:

ssh -NL 5022:<server C IP>:22 <user_serverB>@<server B IP> &
PID=$!
ssh -p 5022 <login ID>@localhost
<< do something >>
kill $PID

But when I try to tunnel a new server D as follows:

ssh -NL 5023:<server D IP>:22 <user_serverB>@<server B IP> &
ssh -p 5023 <login ID>@localhost

The system prompts the message below:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
:

I have to purge the record of localhost entry in ~/.ssh/known_hosts then it can proceed. I have to keep purging if I toggle server C and D.

Is there a way to tunnel multiple servers without purging the localhost record in known_hosts?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
cp how to copy hidden files and copy recusively without over writing ballsystemlord Linux - Software 5 05-25-2015 03:08 PM
Scripting to copy FTP files between servers jfrancis Linux - Newbie 5 09-15-2011 11:55 AM
Copy file between servers from script gr0undz3r0 Linux - Newbie 2 11-13-2006 12:48 PM
Using scp to copy files between servers. muskiediver Linux - General 1 07-11-2006 04:52 PM
How to copy user accounts between servers glt Red Hat 8 09-02-2003 01:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:43 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration