Ubuntu – SCP from remote to local does not work

scpssh

I can scp just fine from local to remove by doing:

scp trip3.csv pi@192.168.2.11:/home/pi/

But when I try to do remote to local it says no such file or directory:

scp pi@192.168.2.11:/home/pi/trip3.csv /Users/andrew/Desktop

When i try scp pi@192.168.2.11:/home/pi/image.jpg ~ it asks for my remote password and shows that the transfer went through, but i can't find the file on my local machine.

Any thoughts?


This is where I am now:

step 1 – ssh into remote host

step 2 – sudo scp pi@192.168.2.11:image.jpg ~
which gives this response: pi@192.168.2.11's password:

step 3 – i enter the correct password which gives this: image.jpg 100% 163KB 162.7KB/s 00:00

step 4 – on local machine i do cd ~ followed by ls | grep image.jpg which does not give any output just a new command line

Best Answer

You have a pretty fundamental mis-understanding of how scp works.

Assuming "local" is where you want the file to end up, and "remote" is where the file is now, do this:

scp user@remote:/path/to/file.name ~

~ can be replaced with where ever you want the file to go on local.

DO NOT ssh to remote first. When you ssh to remote then run that command you are effectively copy the file from remote to remote, which is not what you want.

Do what you are doing, but skip step 1. Run the scp from bash/terminal on your local machine, don't ssh to remote first.

(deleting my other answer as it is no longer relevant)

Related Question