I have file on remote machine. I can list it:
ssh matous@xxx ls -la
the file is in the reponse:
...
-rw-r--r-- 1 matous matous 796672 Oct 11 11:12 D1.db
...
Now If I try to scp it to my local machine:
scp matous@xxx/D1.db /home/matous
I get error:
cp: cannot stat 'matous@x/D1.db': No such file or directory
How is it possible that file exists and cannot be stated? What I am missing?
Best Answer
The syntax of scp is not correct. Try
Without the colon (
:
), scp will try to interpretmatous@xxx/D1.db
as a local path.Note that I omitted the leading
/
. If you would usescp matous@xxx:/D1.db
, thenscp
would try to copy from/D1.db
but this file appears to be in the home directory, which is the default path forscp
to operate in.