Bug 219454 - scp: ambiguous target
scp: ambiguous target
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: openssh (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tomas Mraz
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2006-12-13 03:56 EST by Rainer Traut
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-12-13 08:37:56 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Rainer Traut 2006-12-13 03:56:54 EST
Description of problem:
scp fails to identify a target, if it contains spaces

Version-Release number of selected component (if applicable):

How reproducible:
always if remote path has spaces

Steps to Reproduce:
1. # scp testfile tr@neptun:"/home/tr/dir with spaces/"
tr@neptun's password:
scp: ambiguous target

2. # scp testfile tr@neptun:'/home/tr/dir with spaces/'
tr@neptun's password:
scp: ambiguous target

3. # scp testfile tr@neptun:/home/tr/dir\ with\ spaces/
tr@neptun's password:
scp: ambiguous target

any variant I have forgotten?

Actual results:
scp fails to copy

Expected results:
scp should copy

Additional info:
Maybe fixed in later versions?
Comment 1 Rainer Traut 2006-12-13 04:58:29 EST
both machines (source and target) are El4.4
Comment 2 Tomas Mraz 2006-12-13 08:37:56 EST
scp is run on the remote side through shell and it expands the arguments. This
allows for example 'scp remote.server:*.c .'.

So the spaces must be double-escaped like this:

# scp testfile tr@neptun:'/home/tr/dir\ with\ spaces/'

Note You need to log in before you can comment on or make changes to this bug.