LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 01-21-2011, 03:33 PM   #1
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Rep: Reputation: 60
Transferring Files via Reverse SSH


I currently have clients to where I have them reverse ssh into my company ssh server and then I just simply connect to them via a tunnel to my ssh server.

PHP Code:
client -------reverse ssh----------->>my ssh server<<-------ssh tunnel-------<<myself@remote_location 
My questions is once I have establish a connection to my remote clients via reverse ssh, how can I transfer data via my already establish tunnel? or better said, how can I transfer files through a reverse ssh session?
 
Old 01-21-2011, 05:49 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,345
Blog Entries: 28

Rep: Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145
Use scp, not ssh.

It could be described as ssh for files.
 
Old 01-24-2011, 12:00 PM   #3
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
thanks for the reply but how I would do it via a reverse ssh connection?
 
Old 01-24-2011, 09:16 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,345
Blog Entries: 28

Rep: Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145
You can ssh into computer B and then scp back to computer A. As I understand it, ssh is for command and control, scp is for file transfer.

I just ssh'd into my file server and scp'd a file back to this computer and it arrived safely.

Alternatively, if I understand the rsync man pages correctly, rsync can be used to pull from a remote host as well as to push to a remote host, but I've never tried that.

I've just learned how to use rsync for backups. I shall enjoy the glow from that for a while before moving on.
 
Old 01-25-2011, 04:20 AM   #5
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by metallica1973 View Post
Code:
client -------reverse ssh----------->>my ssh server<<-------ssh tunnel-------<<myself@remote_location
What tunnel do you set up in detail? The clients issue something like:
Code:
ssh -R 1234:localhost:22 my_ssh_server
and you now want to use this opened reverse tunnel from another outside machine?
 
Old 01-25-2011, 08:22 AM   #6
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
exactly,

I have my clients connect to an ssh server in my office and then from whenever I am I just simply ssh(locally port forwarding) and connect to my client.

PHP Code:
client -------reverse ssh----------->>my ssh server<<-------ssh tunnel-------<<myself@remote_location 

thanks for the reply.
 
Old 01-25-2011, 08:31 AM   #7
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Maybe you have to combine two tunnel. E.g.:

Client does: ssh -R 1234:localhost:22 my_ssh_server
(maybe with -N if a command prompt isn't needed)

You do on your local machine: ssh -L 4567:localhost:1234 my_ssh_server
(maybe with -N if a command prompt isn't needed)

Then something like this should work on your local machine: scp -P 4567 my_file localhost:
or: scp -P 4567 localhost:my_file .
or: sftp -oPort=4567 localhost

(you can use the same port number, but I used different ones here to make clear they needn't to be the same.)
 
Old 02-07-2011, 01:01 PM   #8
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
thanks for the reply, so how would I be able to look at the files on the remote machine before copying? Some of my clients are using windows machines. that is the tricky part! So a typical client connection would be like this:


The my client with a windows machine connects to my ssh server using

PHP Code:
ssh -R 5900:localhost:12022 windows_client@my_ssh_server 
and has vnc_server listen so that I can view his desktop

and I from a remote location location:

PHP Code:
ssh -L 5900:localhost:12022 admin@my_ssh_server 
so my questions would be:

1 - How would I transfer files to a windows machine via this method?

2 - How can I view the files on the remote linux client via method?

Last edited by metallica1973; 02-07-2011 at 01:31 PM.
 
Old 02-08-2011, 06:15 AM   #9
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
One way is to install Cygwin and get an SSH daemon on the Windows machine running.

Another way could be enable File Sharing on the Windows machine and use the necessary port in -R. Then access this Windows Share from your local machine.
 
Old 02-08-2011, 07:26 AM   #10
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
your awesome thanks.
 
  


Reply



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
Reverse Tunneling / Reverse port forwarding in SSH dynamics Linux - Networking 5 02-07-2017 07:19 AM
Transferring file through ssh dstar101 Linux - Newbie 4 01-19-2008 05:08 AM
Transferring files Denisius Slackware 6 10-27-2007 07:19 AM
Transferring 40000+ files with FTP (mget) shows 0 files tim1235 Linux - Software 5 10-17-2004 06:06 PM
SSH Transferring Question Mark2020 *BSD 1 12-17-2002 08:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:16 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
Open Source Consulting | Domain Registration