0

I have the following username@machine connection

user1@machine1 -> user2@machine2

How can I copy files from machine2 to machine1?

davidgh
  • 1,293
  • 1
  • 9
  • 7
  • If you can be more clear you'll get a better answer. – Ghazanfar Sep 08 '15 at 06:36
  • I have access to my local machine1 with user1 username, From machine1 I can ssh to machine2 with user2 username. I can only connect from machine1 to machine 2 : So I can run only the following on machine1 From machine2 I have no connection to machine1. I have to copy files from machine2 to machine1 – davidgh Sep 08 '15 at 06:40
  • You can do that with scp. I added an example. – Ghazanfar Sep 08 '15 at 06:49

2 Answers2

0

You can use scp

Use it like this

scp <source path> <destination path>

Where the remote file is addressed as user_name@host_name:path/to/file


Suppose you want to get a file named a.txt which is in the home directory of user user2 on machine2 say, 192.168.1.10. You can do this on your machine1,

scp user2@192.168.1.10:a.txt .
Ghazanfar
  • 1,419
  • 13
  • 21
0

You can use rsync

Use it like this:

rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/ 

Here is step by step tutorial. You can read about differences between rsync and scp here

Community
  • 1
  • 1
janisz
  • 6,292
  • 4
  • 37
  • 70