Im using codeship for deployment and it provides a way to access the build machine with ssh:
ssh rof@1.2.3.4 -p 65503
This works fine and I get into the machine. Now I want to copy a file from the remote machine to my local machine. Im trying:
sudo scp -p 65503 -v -i ~/.ssh/id_rsa rof@1.2.3.4:~/home/rof/cache/app.js /
And I get a whole host of errors:
cp: 65503: No such file or directory
cp: -v: No such file or directory
cp: -i: No such file or directory
rof@23.20.112.101: Permission denied (publickey).
I dont know why it's saying No such file or directory
for each argument.
id_rsa
exists and is in ~/.ssh/
directory.
The Permission Denied error appears to be a separate issue.
Any ideas?
The first problem I see from looking at the documentation:
-P port
Specifies the port to connect to on the remote host. Note that
this option is written with a capital āPā, because -p is
already reserved for preserving the times and modes of the
file.
-p Preserves modification times, access times, and modes from the
original file.
So scp -p
is taken to mean "copy while preserving timestamps" and 65503
is the name of (one of the) source file(s).
Try scp -P 65503
instead.