Mark
Mark

Reputation: 5088

No such file or directory error on scp command

Im using codeship for deployment and it provides a way to access the build machine with ssh:

ssh [email protected] -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 [email protected]:~/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
[email protected]: 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?

Upvotes: 1

Views: 5273

Answers (1)

melpomene
melpomene

Reputation: 85767

The first problem I see from looking at the documentation:

man scp:

 -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.

Upvotes: 2

Related Questions