Target path with space: "scp: ambiguous target"
Brought to you by:
chronocide
Whenever I want to transfer a file via scp to a remote path that has spaces in either path- or filename, then I get "scp: ambiguous target".
This works fine with the normal shell - only if the user has scponly as shell it fails.
Normal shell works:
> $ scp "foo bar.png" "server:foo\ bar.png"
> foo bar.png 100%
Scponly shell fails:
> $ scp "foo bar.png" "server:foo\ bar.png"
> scp: ambiguous taret
This issue had been reported on the mailing list 5 years ago and is still a problem: http://lists.ccs.neu.edu/pipermail/scponly/2007-April/001749.html
In my experience:
scp foo\ bar.png server:"foo\ bar.png"
or, if called from a script
scp foo\ bar.png server:"foo\\ bar.png"
works when using scponly - and from discussions elsewhere are also the correct syntax for any use of scp. Putting the source file in quotes is also okay. Maybe including the server name in the second set of quotes is the problem you've seen.
Last edit: Whit Blauvelt 2015-12-31