LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-15-2006, 06:57 PM   #1
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Rep: Reputation: 31
Program to transfer file 'backwards' over SSH


Background:

Computer A is behind a NAT router. Computer A can access the world, but nothing external can find its way to Computer A because of the router.

Computer B is world-accessible for SSH. I can SSH and SFTP from A to B but not from B to A.

The problem:

I want to be able to transfer files from B to A.

Is there any program out there which will let me SSH from A into B, and then from B, at the command line, send a file back to A over the already established SSH connection?

I know this assumes a persistent connection, but that isn't much of an issue.

I just want to be able to sit at computer A, open an SSH (or SFTP) session to B, then go over to B and be able to send files back to A.

Is this possible?

Thanks,
Jason
 
Old 10-15-2006, 07:33 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
Hi.

Two ways to do this:

1) Just use sftp, and 'get' whatever you need

2)
Code:
ssh user@remotehost "cat /path/to/remote/filename" > /path/to/local/filename
Dave

Last edited by ilikejam; 10-15-2006 at 07:35 PM.
 
Old 10-15-2006, 07:39 PM   #3
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Check into the -R option for ssh. It allows reverse mapping. Might be what you are after.

Brian
 
Old 10-15-2006, 08:42 PM   #4
chadl
Member
 
Registered: Sep 2005
Location: US
Distribution: Gentoo AMD64 Testing
Posts: 129

Rep: Reputation: 16
If you use scp you can put the remote file on whatever side you want:

Code:
scp chadl@example.com:foo.bar .
would get the file from example.com to the local system

Code:
scp foo.bar chadl@example.com:.
will get the file from the local system, and put it on example.com.
 
Old 10-17-2006, 12:03 AM   #5
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by Brian1
Check into the -R option for ssh. It allows reverse mapping. Might be what you are after.

Brian
I'll look into the docs. Do you know how I would implement this for rcp, or rlogin?

The two previous posts seem to have misunderstood my point.

I want to upload a file from Computer A to Computer B, where B can't connect to A, and I NO LONGER HAVE PHYSICAL ACCESS to A.

--------
If you want the total, complete scenario:

I am away at college, and work as a systems programmer for the university. The dorms / residential network is behind a NAT router which (obviously) doesn't allow incoming connections (to my dorm computer, herein "A"). I want to be able to access my dorm computer (A) from work (B), which has a university-wide IP.

So what I need is to be able to somehow connect from A at the dorm to B at work in the morning, then go to work (using computer B), and be able to send files (or, maybe, get a shell) back to A at home (dorm).
 
Old 10-17-2006, 01:48 AM   #6
prasanta
Member
 
Registered: Mar 2005
Location: India
Distribution: Debian
Posts: 368

Rep: Reputation: 37
What about using rsync, which works over ssh.

--
Prasanta
 
Old 10-17-2006, 01:10 PM   #7
joshartman
LQ Newbie
 
Registered: Oct 2005
Location: Egliswil, Switzerland
Distribution: Slackware
Posts: 2

Rep: Reputation: 0
Use OpenVPN on both side. The server is on your work computer and the client on your home computer. You can have full IP access both directions or if you use iptables you can control access.
 
  


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
file transfer over ssh? jme Linux - Software 5 11-13-2006 02:30 AM
File transfer program!! vishamr2000 Programming 11 04-27-2006 05:22 AM
SSH File transfer wjeanpaul Linux - General 19 02-07-2006 03:34 PM
File transfer with SSH? Baix Linux - Newbie 5 01-28-2005 07:24 PM
ssh file transfer? Apostasy Linux - Newbie 11 07-30-2004 11:33 PM


All times are GMT -5. The time now is 11:42 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration