Copy files via SSH between two remote servers

Asked

Viewed 59,952 times

7

How to copy files from Servier1 to servor2 via SSH with only one command line, and I am not logged in to any of them?

I’m on a third machine. And I have the credentials of both.

4 answers

12


You can do this quietly, just use the scp command.

scp usuario1@host1:path/* usuario2@host2:path/*

If the copy is only of files use the /* if you have folder use the -r in the scp.

scp -r usuario1@host1:path usuario2@host2:path
  • ON THE FLY! Thank you very much, man!

0

If you are using Linux and are in graphical environment, open the TERMINAL (Depending on the Interface you are using Ex.: Gnome, Kde, LXDE...), open three tabs and see the source/destination content you want to copy.

Or if you’re on Windows, use Putty.

Once done, execute the command:

scp "nome do arquivo / diretório " "nome do usuário"@"endereço ip da máquina":/"destino"

0

scp arquivo usuario@servidor:/home/usuario

Doesn’t happen?

  • I am on an A machine. I want to copy files from the servorX to the servorY. I can’t go into Y and log into X from there to make a direct transfer. Not the other way around.

  • 1

    You can elaborate a little more?

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.