3

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

scp trip3.csv [email protected]:/home/pi/

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

scp [email protected]:/home/pi/trip3.csv /Users/andrew/Desktop

When i try scp [email protected]:/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 [email protected]:image.jpg ~ which gives this response: [email protected]'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

8
  • You scp'd from local to remote and are searching for the file in local? O.o
    – muru
    Feb 4, 2015 at 4:22
  • @muru according to this, i thought i had the right formatting hypexr.org/linux_scp_help.php do you know how i can this properly?
    – metersk
    Feb 4, 2015 at 4:25
  • Ok, help me understand this. Call one system A, the other B. You SSH'd from A to B - irrelevant. Then you scp'd from A to B on B. Therefore a file is now on B. You are looking for the file on A. Am I right?
    – muru
    Feb 4, 2015 at 4:27
  • @muru System A is my Laptop, System B is my Raspberry Pi: I ssh'd from A into B. I have a file on B that I want on A. I thought I was scp'ing from B to A, hence me looking for the file on A.
    – metersk
    Feb 4, 2015 at 4:39
  • The general syntax is: scp source[s] target. So try: scp ~/image.jpg pi@...:...
    – muru
    Feb 4, 2015 at 4:44

2 Answers 2

9

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)

1
  • Dude you saved my life and also saved me from doing hours of research. Thanks a lot. I was trying to scp from inside the server and saying myself why the commands are not working!!
    – Neptune
    Oct 5, 2022 at 13:32
0

Your address 192.168.x.y indicates you may be going out through NAT/firewall. While it's possible to go out through NAT that is not the case to other direction. Coming back is possible if you open ssh connection first using such a parameter that opening connection to reverse direction using existing connection is allowed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .