scp: ambiguous target

I was attempting to secure copy a file over a remote server and I encountered the following error:
$ scp file.txt user@ip_address:”/file path/”
scp: ambiguous target

So after some trial and error I discovered the problem was the space ” ” in the path to which I was attempting to copy the file to. I knew you would have to escape the space with a ” ” however I would still get the error.

To solve this problem you need to escape the space AND add the quote around the path
$ scp /file/to/copy user@desthost:”/file path/”

One thought on “scp: ambiguous target”

  1. admin says:


Leave a Reply

Your email address will not be published. Required fields are marked *