Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-09-2009, 04:01 PM   #1
LQ Newbie
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Copying Directory Between Computers with Gateway Server

So I've recently begun working on a project where the files are stored on a computer at another university. I'd like to be able to copy directory where the files I'm using are located from the Linux computer where they're stored to my Windows Computer. I'm using Cygwin to connect between the computers. The problem I'm having is that, in order to connect to the other computer, there is a gateway server that must be connected to first, then from there I can ssh to another computer in the network to access the directory.

My login process is something like this:

ssh username@gw.destin[/email]ation

ssh username@computer1.destin[/email]ation

I've tried to copy the files, but I keep running into problems. For example, I tried to sftp from my computer, but I can't get past the gateway (when the password prompt comes up, I get an "unexpected newline" error), and I've tried the cp function from the source directory,

cp -r /sourcedirectory/ user@mycomputer:/cygdrive/destinationdirectory/

but I can't get it to copy over to my computer (it tells me that the destination directory doesn't exist).

Am I missing something simple? Can anyone think of something I could try to get these files to copy?

Thanks to whoever answers!

Last edited by grescheks; 11-09-2009 at 04:11 PM.
Old 11-09-2009, 04:32 PM   #2
Registered: Oct 2009
Location: Budapest
Distribution: Mostly Gentoo, sometimes Debian/(K)Ubuntu
Posts: 143

Rep: Reputation: 22
Port forward

It would be much simpler if you did a forward / reverse port forward on your gateway.
Old 11-09-2009, 06:18 PM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
If setting up port fwd is not possible, just scp from computer1 to gateway, then scp gateway to wkstn.
Old 11-09-2009, 06:37 PM   #4
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
I don't use windows or cygwin, so I'm making assumptions about how unixy a setup it provides you with. In a real *nix machine the following should work.

First open a tunnel from port 6666 on your own machine, pointing to port 6666 on the gateway machine. This will also give you a shell on the gateway machine. Then using this shell forward port 6666 on the gateway machine to port 22 (ssh) on "computer1" (where the files are).
windoze% ssh -L6666:localhost:6666 username@gw.dest
gw.dest% ssh -L 6666:localhost:22 username@computer1.dest
Now in a 2nd terminal on your own machine you can get directly to "computer1" (machine behind gateway) by sshing to port 6666 on the localhost (your ownmachine). In this context "localhost:6666" can be thought of as the ssh server on the machine behind the gateway.

windoze% scp -r localhost:6666/path/to/directory/on/computer1 .



copying, directory, gateway

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
user's home directory on NFS server--what happens when user logs in from 2 computers? Mountain Linux - Networking 1 03-18-2009 04:35 PM
Copying files from fedora 7 system stalls at max of 10 windows xp computers TheTeacher Linux - Networking 0 08-13-2008 06:54 PM
Copying files from fedora 7 system stalls at max of 10 windows xp computers TheTeacher Linux - Newbie 4 08-13-2008 06:48 PM
Copying a single file into each directory of a directory tree mlapl1 Linux - Newbie 2 06-27-2007 11:18 PM
Automatically Copying files from the ftp directory into the html directory swatward Linux - General 3 04-17-2005 11:55 PM > Forums > Linux Forums > Linux - Newbie

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

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