ssh - transfers with gateway hopping


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users ssh - transfers with gateway hopping
# 1  
Old 09-29-2008
ssh - transfers with gateway hopping

Hi,

I am having trouble transferring files from a source UNIX machine to a
destination UNIX machine by hopping via 2 gateway machines.
The user used for the transfer has been setup/authorized so no password is
required to login. Summerized:
source to gateway1 to gateway2 to destination

This is the command executed from the source computer:
tar cf - .|ssh gateway1 ssh gateway2 "ssh dest 'cd /tmp;tar xf -'"
I get following error:
tar: blocksize = 0

If I change the command to:
tar cf - .|ssh gateway1 ssh gateway2 "ssh dest tar xf -"

Then the files are transferred albeit into the wrong directory but the
command on the source computer never completes.

How can I fix:
1) get the cd /tmp to work
2) get the command to come back when the transfer is complete

Thanks for any help
# 2  
Old 09-29-2008
Can you please explain your scenario?
Are you able to connect to destination system?

I don't think these gateway's should matter.

- nilesh
# 3  
Old 09-29-2008
I think you need to run the commands at the destination in a sub-shell at the destination (replace the single quotes with parenthesis)
Code:
tar cf - .|ssh gateway1 ssh gateway2 "ssh dest (cd /tmp;tar xf -)"

may do what you require, but I don't have four machines to test this with, have tried it between two and it works.

And the reason the originating tar doesn't complete is probably because it is waiting for input from the command line (tar cf -) for the files you wish to archive. to close it you need a CTRL-D in the input stream, or give it a list, or a toplevel directory (tar cf - /top/level/directory/)

Last edited by wempy; 09-29-2008 at 08:18 AM.. Reason: clarification and correction
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Inconsistency between RedHat 6.5 global gateway and single gateway leads to loss of default gateway

Dear friends I use RedHat 6.5, which sets the gateway in the configuration file / etc / sysconfig / network as GATEWAY = 192.168.1.26, and the gateway in the configuration file / etc / sysconfig / network-scripts / ifcfg-eth11 as GATEWAY = 192.168.1.256. The two gateways are different.... (6 Replies)
Discussion started by: tanpeng
6 Replies

2. UNIX for Beginners Questions & Answers

Sftp transfers file partially

Hi ALL, I have a shell script using except : #!/bin/bash HOST=abc.com USER=abc PASSWORD=123 SOURCE_FILE=file1.zip TARGET_DIR=/A/B/C /usr/bin/expect <<- EOF spawn /usr/bin/sftp $USER@$HOST expect "password:" send "$PASSWORD\r" expect "sftp>" send "cd patch1\n" ... (11 Replies)
Discussion started by: Asad
11 Replies

3. Shell Programming and Scripting

Identify failed file transfers during SFTP

Hi All, I have a pretty demanding requirement for an SFTP script I have been trying to put together. I have nearly 100 files (all with the names staring with T_PROD) generated in my local server daily. I need to transfer each of these files to a remote server via SFTP (that's a client... (6 Replies)
Discussion started by: Aviktheory11
6 Replies

4. OS X (Apple)

The Great Hopping Unkillable PID

Hi all, VLC goes all SWOD on me today, so naturally I try to force quit the process. Nothing. Drop into Terminal and run ps ax | grep vlc, noting that kill has no effect, nor killall. The PID is hopping up! W T F? MADDENING! Killall was made for this right? Killall says no such... (2 Replies)
Discussion started by: aaronbsdf
2 Replies

5. Linux

GNUGK-How to setup static gateway to gateway routing

Dear Sir I am a newbie in the world of IP telephony. I have been working with Asterisk PBX (SIP) and Cisco Call Manager (MGCP) but now I am learning on how to work GNUGK for H.323 Gatekeeper. I am having a problem, configuring static call routing on GNUGK in the section ... (0 Replies)
Discussion started by: mfondoum
0 Replies

6. Cybersecurity

automatic SCP transfers issues

Hi, I'm trying to set up scp but it isn't as nice as WinSCP. My requirement is to transfer a file from one machine to another with scp. This would run in a .ksh so it would need to avoid prompts (password/are you sure). First I tried this with v2: SSH with Keys HOWTO: SSH with Keys in a console... (1 Reply)
Discussion started by: Dird
1 Replies

7. UNIX for Advanced & Expert Users

tunneling commands and file transfers through established ssh connection

Hi - I frequently run commands, and transfer files to/from a host that uses SecurID ssh authentication. It is a real pain to have to enter the authentication information every time I want to interact with this host. I am wondering if there is a way to establish a one-time ssh connection to this... (2 Replies)
Discussion started by: cpp6f
2 Replies

8. UNIX for Advanced & Expert Users

How does netcat manage the data it transfers ?

Hi all, When using netcat to transfer the data over socket, if no connection is established, how long will netcat keep the data; will it discard the "oldest" data ? Say for example I use "Some Command | netcat -l -p port", the command I use will generate a lot of output constantly, while no... (2 Replies)
Discussion started by: qiulang
2 Replies

9. Shell Programming and Scripting

ssh root@mrp-gateway problems

Dear friends, exec 0<$SuppFile while read LINE do echo $LINE gatewayArchive=`ssh root@mrp-gateway "cd /usr/local/apache/data/PLAT/MIMUS/upload/PROD/archive && ls $LINE"` echo "gateway files :"$gatewayArchive done this loop is not repeating when i use ssh root@mrp-gateway line of code.... (1 Reply)
Discussion started by: kittusri9
1 Replies

10. UNIX for Dummies Questions & Answers

History of old FTP transfers

How can one find the name and size of files ftp'ed during an old ftp transfer. Is there any log where these details are stored or any UNIX command which can provide these details. Thanks in advance. (4 Replies)
Discussion started by: Nakul Mukerjee
4 Replies
Login or Register to Ask a Question