LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Transferring Files via Reverse SSH (https://www.linuxquestions.org/questions/linux-networking-3/transferring-files-via-reverse-ssh-857863/)

metallica1973 01-21-2011 03:33 PM

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?

frankbell 01-21-2011 05:49 PM

Use scp, not ssh.

It could be described as ssh for files.

metallica1973 01-24-2011 12:00 PM

thanks for the reply but how I would do it via a reverse ssh connection?

frankbell 01-24-2011 09:16 PM

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.

Reuti 01-25-2011 04:20 AM

Quote:

Originally Posted by metallica1973 (Post 4233391)
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?

metallica1973 01-25-2011 08:22 AM

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.

Reuti 01-25-2011 08:31 AM

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.)

metallica1973 02-07-2011 01:01 PM

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?

Reuti 02-08-2011 06:15 AM

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.

metallica1973 02-08-2011 07:26 AM

your awesome thanks.


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