LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-09-2009, 04:01 PM   #1
grescheks
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
password

ssh username@computer1.destin[/email]ation
password

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
janoszen
Member
 
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
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,310

Rep: Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039
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
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,514

Rep: Reputation: 1215Reputation: 1215Reputation: 1215Reputation: 1215Reputation: 1215Reputation: 1215Reputation: 1215Reputation: 1215Reputation: 1215
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).
Code:
windoze% ssh -L6666:localhost:6666 username@gw.dest
gw.dest% ssh -L 6666:localhost:22 username@computer1.dest
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.

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

Evo2.
 
  


Reply

Tags
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


All times are GMT -5. The time now is 09:37 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration