SCP from remote to local does not work
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 videos on Youtube
metersk
Updated on September 18, 2022Comments
-
metersk over 1 year
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 byls | grep image.jpg
which does not give any output just a new command line-
muru over 9 yearsYou scp'd from local to remote and are searching for the file in local? O.o
-
metersk over 9 years@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?
-
muru over 9 yearsOk, 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?
-
metersk over 9 years@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 over 9 years@muru
scp ~/image.jpg [email protected]:image.jpg
did not work. i got this dialog in raspberry pi[email protected]'s password: image.jpg 100% 163KB 162.7KB/s 00:00
but no file in~
on local -
floodpants over 9 years@Meepl step one is ssh step 4 is looking on the local machine. Are you looking for the file on the same machine you ssh into in step 1?
-
metersk over 9 years@drixny I ssh from laptop into RPi. I attempt to send a file from RPi to laptop. I look for file on laptop.
-