COPY file from one server to another

8,576

Looks like your prod server can't reach the dev server (on ssh). I assume you can reach both from your workstation. You can use scp 3 hosts copy, which copies between hosts using a 3rd one (in your case prod05 -> workstation -> dev 01). Of course it's not the fastest way to copy, both perfect when you have to copy once and you have firewall issues.

Run the following on your workstation (where you can reach both):

scp -3 prod05:/tmp/sbg.snappy [email protected]:/tmp

From the man page of scp:

 -3      Copies between two remote hosts are transferred through the local host.
         Without this option the data is copied directly between the two
         remote hosts.  Note that this option disables the progress meter.
Share:
8,576

Related videos on Youtube

akr
Author by

akr

Updated on September 18, 2022

Comments

  • akr
    akr almost 2 years

    I have to get some files from production to DEV server. SCP command gives the timeout.

    I do not have ip and I connect to the server using ssh command as below.

    ssh [email protected]
    sudo -u xxx_bio_xxx -i
    
    • ss_iwe
      ss_iwe almost 6 years
      If scp is giving Timeout , first that has to be fixed! Check ConnectTimeout parameter in ssh config! It could also be that the remote server is not reachable.
    • redseven
      redseven almost 6 years
      Can you specify more? Where you start the scp command, on the prod server or on the dev server? (please copy&paste the ommand as well) And when it gives you timeout? It can not start the copy or starts the copy, but runs into timeout later?
    • akr
      akr almost 6 years
      i am sorry i am new to linux. how to find out wat unix i am using. how can i check the ConnectTimeout
    • akr
      akr almost 6 years
      i did scp command from prod.
    • akr
      akr almost 6 years
      [sys_bio_tern@prod05 tmp]$ scp /tmp/sbg.snappy [email protected]:/tmp ssh: connect to host dev01.corp.xxx.net port 22: Connection timed out lost connection
    • ss_iwe
      ss_iwe almost 6 years
      @komz OS Name- cat /proc/version , run this command: scp -vvv /tmp/sbg.snappy [email protected]:/tmp, this will give info about the problem. Update the Question with these outputs.
    • ss_iwe
      ss_iwe almost 6 years
      Also run ping <dev_server_ip> command from prod to the other server! This would tell you about the connectivity!
    • ss_iwe
      ss_iwe almost 6 years
      You can also run ping dev01.corp.xxx.net
    • Javier Salas
      Javier Salas almost 6 years
      scp is based on SSH, that would mean that you could not even connect by SSH, are you able?
    • akr
      akr almost 6 years
      @saisasanka i m getting this output for -vvv . Executing: program /usr/bin/ssh host dev01.corp.xxx.net, user komz-admin, command scp -v -t /tmp OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to dev01.corp.xxx.net [10.142.128.51] port 22. debug1: connect to address 10.142.128.51 port 22: Connection timed out ssh: connect to host dev01.corp.xxx.net port 22: Connection timed out lost connection
  • ss_iwe
    ss_iwe almost 6 years
    If scp is giving Timeout , first that has to be fixed! As man rsync says For remote transfers, a modern rsync uses ssh for its communications unless otherwise modified. So ConnectTimeout parameter is critical. It could also be that the remote host is not reachable. Its just not that the scp failed but rsync is going to work.
  • akr
    akr almost 6 years
    @Syed Abdul Qadeer how to check connectivity from prod to server
  • akr
    akr almost 6 years
    how to capture ssh logs. i am not getting any logs.
  • akr
    akr almost 6 years
    scp: illegal option -- 3 getting this error
  • Syed Abdul Qadeer
    Syed Abdul Qadeer almost 6 years
    just perform ssh root@<ip address>