Attempting to scp from one droplet to another only copied to local droplet

I had to instantiate a droplet from a snapshot of another droplet to recover some files I managed to delete. I logged into the new Droplet (lz2), created an ssh key pair, and copied and pasted the key contents to the authorized_keys file on the orignal Droplet. I was able to ssh to it after that without issue.

But try as I might, I could not get scp or rsync to work. They would just copy to the local host. I tried invoking it several different ways:

rmann@lz2:~$ scp nginx.tgz lz1:
rmann@lz2:~$ scp nginx.tgz lz1:ng.tgz
rmann@lz2:~$ scp nginx.tgz rmann@lz1:ng.tgz
rmann@lz2:~$ scp nginx.tgz <lz1’s IP address>:ng.tgz

All of them resulted in ng.tgz being created in ~rmann on lz2. For the life of me I can’t figure out what was happening.

I ended up copying the file down to my laptop from lz2 and back up to lz1.

Any idea why it wouldn’t copy from one Droplet to the other, but also not give me an error, isntead copying to the local machine?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 6, 2024


When you’re using scp to copy files from one host to another, the syntax should specify the source and destination clearly. If you’re executing the command from lz2 and want to copy a file to lz1, you should specify the user and host for the destination along with the full path. If rmann is your username on both droplets and lz1 is the hostname or IP address of the destination droplet, the command should look like this:

scp nginx.tgz rmann@lz1:/home/your-user/ng.tgz

Or, if you want to use the IP address of lz1, it would be:

scp nginx.tgz rmann@<lz1's IP address>:/home/your-user/ng.tgz

This command tells scp to copy nginx.tgz to the /home/your-user/ directory on lz1, saving it as ng.tgz.

If these commands still result in the file being copied to the local machine (lz2), it’s highly unusual behavior for scp. Ensure that the hostname or IP address for lz1 is correct and reachable. If there’s any confusion about the hostnames, using the IP address can eliminate any potential DNS or host file misconfigurations.

Also, using the -v flag for verbose output can help diagnose the issue, as it will provide detailed information about the scp process and where it might be going wrong.

Let me know how it goes!



Site Moderator
Site Moderator badge
March 6, 2024

Heya @jetforme,

Okay, if you can SSH from one droplet to the other then you have access between them. From where did you run SCP? You’ll need to enter one of the Droplets(it doesn’t matter which, it would matter only to the command) and SCP the files to or from the other.

Now, let’s assume you have SSHed to Droplet 1 and you need to copy files from Droplet 2 to Droplet 1.

Here is how it should work

scp username@droplet2_ip:/path/to/remote/file /local/droplet1/path
  • Replace username with your username on Droplet 2, droplet2_ip with Droplet 2’s IP address, /path/to/remote/file with the file’s path on Droplet 2, and /local/droplet1/path with the path on Droplet 1 where you want the file to be copied to. That should do the trick.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel