Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Elvis is my copilot." -- Cal Keegan


devel / comp.unix.shell / scp: ambiguous target

SubjectAuthor
* scp: ambiguous targetKenny McCormack
+* Re: scp: ambiguous targetChristian Weisgerber
|`* Re: scp: ambiguous targetKenny McCormack
| `* Re: scp: ambiguous targetChristian Weisgerber
|  `- Re: scp: ambiguous targetKenny McCormack
`- Re: scp: ambiguous targetHauke Fath

1
scp: ambiguous target

<tm8579$n2c2$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5867&group=comp.unix.shell#5867

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: scp: ambiguous target
Date: Wed, 30 Nov 2022 17:51:37 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <tm8579$n2c2$1@news.xmission.com>
Injection-Date: Wed, 30 Nov 2022 17:51:37 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="756098"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Wed, 30 Nov 2022 17:51 UTC

tl;dr -> scp errs out if the target directory (on remote system) name has
spaces in it.

Something like:

$ scp file "RemSys:/path/that contains spaces"

Get an err msg something about "ambiguous target".

Workaround/fix is to double quote like thus:

$ scp file "RemSys:'/path/that contains spaces'"

I was able to figure this out, but it is weird. Any idea if/where/how this
problem is documented?

--
"I think I understand delicate, but why do I have to wash my hands, and
be standing in cold water when doing it?"

Kaz Kylheku <kaz@kylheku.com> in comp.lang.c

Re: scp: ambiguous target

<slrntofdso.gau.naddy@lorvorc.mips.inka.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5872&group=comp.unix.shell#5872

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: nad...@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: scp: ambiguous target
Date: Wed, 30 Nov 2022 20:05:44 -0000 (UTC)
Message-ID: <slrntofdso.gau.naddy@lorvorc.mips.inka.de>
References: <tm8579$n2c2$1@news.xmission.com>
Injection-Date: Wed, 30 Nov 2022 20:05:44 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="16735"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Christian Weisgerber - Wed, 30 Nov 2022 20:05 UTC

On 2022-11-30, Kenny McCormack <gazelle@shell.xmission.com> wrote:

> tl;dr -> scp errs out if the target directory (on remote system) name has
> spaces in it.

Fixed in OpenSSH 9.0:

------------------->
This release switches scp(1) from using the legacy scp/rcp protocol
to using the SFTP protocol by default.

Legacy scp/rcp performs wildcard expansion of remote filenames (e.g.
"scp host:* .") through the remote shell. This has the side effect of
requiring double quoting of shell meta-characters in file names
included on scp(1) command-lines, otherwise they could be interpreted
as shell commands on the remote side.

This creates one area of potential incompatibility: scp(1) when using
the SFTP protocol no longer requires this finicky and brittle quoting,
and attempts to use it may cause transfers to fail. We consider the
removal of the need for double-quoting shell characters in file names
to be a benefit and do not intend to introduce bug-compatibility for
legacy scp/rcp in scp(1) when using the SFTP protocol.

Another area of potential incompatibility relates to the use of remote
paths relative to other user's home directories, for example -
"scp host:~user/file /tmp". The SFTP protocol has no native way to
expand a ~user path. However, sftp-server(8) in OpenSSH 8.7 and later
support a protocol extension "expand-path@openssh.com" to support
this.

In case of incompatibility, the scp(1) client may be instructed to use
the legacy scp/rcp using the -O flag.
<-------------------

If you have at least OpenSSH 8.7:

------------------->
- scp(1): experimental support for transfers using the SFTP protocol
as a replacement for the venerable SCP/RCP protocol that it has
traditionally used. SFTP offers more predictable filename handling
and does not require expansion of glob(3) patterns via the shell
on the remote side.

SFTP support may be enabled via a temporary scp -s flag. It is
intended for SFTP to become the default transfer mode in the
near future, at which time the -s flag will be removed. The -O
flag exists to force use of the original SCP/RCP protocol for
cases where SFTP may be unavailable or incompatible.
<-------------------

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Re: scp: ambiguous target

<1q294pl.b7lz4ts7hjp0N%dont.spam.usenet@googlemail.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5873&group=comp.unix.shell#5873

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: dont.spa...@googlemail.com (Hauke Fath)
Newsgroups: comp.unix.shell
Subject: Re: scp: ambiguous target
Date: Wed, 30 Nov 2022 21:43:40 +0100
Organization: Meistens
Lines: 20
Message-ID: <1q294pl.b7lz4ts7hjp0N%dont.spam.usenet@googlemail.com>
References: <tm8579$n2c2$1@news.xmission.com>
Reply-To: hauke@Espresso.Rhein-Neckar.DE (Hauke Fath)
X-Trace: individual.net AFVUsP22z8A1Iweg7HeZ+wO4RjnNd7YjlYBcdS9VjfCZ8CkJHn
X-Orig-Path: dont.spam.usenet
Cancel-Lock: sha1:ThJGVukNXjneJPDJIn1nZRJKE+A=
User-Agent: MacSOUP/D-2.8.6b1 (ed136d9b90) (Mac OS 10.13.6)
 by: Hauke Fath - Wed, 30 Nov 2022 20:43 UTC

Kenny McCormack <gazelle@shell.xmission.com> wrote:

> tl;dr -> scp errs out if the target directory (on remote system) name has
> spaces in it.
>
> $ scp file "RemSys:/path/that contains spaces"
>
> Get an err msg something about "ambiguous target".
>
> Workaround/fix is to double quote like thus:
>
> $ scp file "RemSys:'/path/that contains spaces'"
>
> I was able to figure this out, but it is weird.

Not really. In the first example, the shell strips the double quotes and
invokes scp with the path as one argument.

--
Now without signature.

Re: scp: ambiguous target

<tm9q9f$nuf4$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5877&group=comp.unix.shell#5877

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: scp: ambiguous target
Date: Thu, 1 Dec 2022 08:57:19 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <tm9q9f$nuf4$1@news.xmission.com>
References: <tm8579$n2c2$1@news.xmission.com> <slrntofdso.gau.naddy@lorvorc.mips.inka.de>
Injection-Date: Thu, 1 Dec 2022 08:57:19 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="784868"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Thu, 1 Dec 2022 08:57 UTC

In article <slrntofdso.gau.naddy@lorvorc.mips.inka.de>,
Christian Weisgerber <naddy@mips.inka.de> wrote:
>On 2022-11-30, Kenny McCormack <gazelle@shell.xmission.com> wrote:
>
>> tl;dr -> scp errs out if the target directory (on remote system) name has
>> spaces in it.
>
>Fixed in OpenSSH 9.0:
>
>------------------->
>This release switches scp(1) from using the legacy scp/rcp protocol
>to using the SFTP protocol by default.
>
>Legacy scp/rcp performs wildcard expansion of remote filenames (e.g.
>"scp host:* .") through the remote shell. This has the side effect of
>requiring double quoting of shell meta-characters in file names
>included on scp(1) command-lines, otherwise they could be interpreted
>as shell commands on the remote side.

Thanks. This was a helpful, informative post.

....

> SFTP support may be enabled via a temporary scp -s flag. It is
> intended for SFTP to become the default transfer mode in the
> near future, at which time the -s flag will be removed. The -O
> flag exists to force use of the original SCP/RCP protocol for
> cases where SFTP may be unavailable or incompatible.

I haven't gotten around to testing this, but it looks like adding:

-S /usr/lib/sftp-server

to the "scp" command line would enable the new behavior (i.e., unless/until
I get the newest versions of things installed on my system). Is that
correct? Note that, AFAICT, the option is "-S" (capital S), not "-s".

Note also that, on my system(s), /usr/lib/sftp-server is a symlink to
/usr/lib/openssh/sftp-server.

--
"The most unsettling aspect of my atheism for Christians is
when they realize that their Bible has no power to make me
wince. They are used to using it like a cattle prod to get
people to cower into compliance." - Author unknown

Re: scp: ambiguous target

<slrntoi1d6.1ecg.naddy@lorvorc.mips.inka.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5884&group=comp.unix.shell#5884

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: nad...@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: scp: ambiguous target
Date: Thu, 1 Dec 2022 19:51:02 -0000 (UTC)
Message-ID: <slrntoi1d6.1ecg.naddy@lorvorc.mips.inka.de>
References: <tm8579$n2c2$1@news.xmission.com>
<slrntofdso.gau.naddy@lorvorc.mips.inka.de>
<tm9q9f$nuf4$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 1 Dec 2022 19:51:02 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="48486"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Christian Weisgerber - Thu, 1 Dec 2022 19:51 UTC

On 2022-12-01, Kenny McCormack <gazelle@shell.xmission.com> wrote:

> I haven't gotten around to testing this, but it looks like adding:
>
> -S /usr/lib/sftp-server
>
> to the "scp" command line would enable the new behavior (i.e., unless/until
> I get the newest versions of things installed on my system). Is that
> correct?

No. In either mode, scp will invoke ssh to connect to the remote
host:

$ scp foo host:bar
will spawn
/usr/bin/ssh -x -oPermitLocalCommand=no -oClearAllForwardings=yes \
-oRemoteCommand=none -oRequestTTY=no -oForwardAgent=no -s -- host sftp

$ scp -O foo host:bar
will spawn
/usr/bin/ssh -x -oPermitLocalCommand=no -oClearAllForwardings=yes \
-oRemoteCommand=none -oRequestTTY=no -oForwardAgent=no -- host scp -t bar

You can use the -S option to replace "/usr/bin/ssh" with something
else. The only practical use that comes to mind would be a wrapper
script that calls /usr/bin/ssh with some additional options, given
that scp doesn't have a configuration file.

- - - -

Nowadays people might no longer know, but Tatu Ylönen wrote ssh as
a drop-in replacement for the Berkeley rlogin/rsh/rcp suite. The
scp command was directly derived from the rcp code; rcp in turn had
been written by Bill Joy all the way back in 1982.

The completely revamped SSH2 protocol gained a whole file transfer
subprotocol (SFTP), for which OpenSSH has provided the sftp(1)
client. However, people prefer the scp(1) command line syntax, so
after years of hemming and hawing, OpenSSH has finally gone ahead
and moved scp over to SFTP, and fixed the quoting issue in the
process--or deliberately broke compatibility, however you want to
see it.

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Re: scp: ambiguous target

<tmbbbb$om0v$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5888&group=comp.unix.shell#5888

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: scp: ambiguous target
Date: Thu, 1 Dec 2022 22:54:35 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <tmbbbb$om0v$1@news.xmission.com>
References: <tm8579$n2c2$1@news.xmission.com> <slrntofdso.gau.naddy@lorvorc.mips.inka.de> <tm9q9f$nuf4$1@news.xmission.com> <slrntoi1d6.1ecg.naddy@lorvorc.mips.inka.de>
Injection-Date: Thu, 1 Dec 2022 22:54:35 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="808991"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Thu, 1 Dec 2022 22:54 UTC

In article <slrntoi1d6.1ecg.naddy@lorvorc.mips.inka.de>,
Christian Weisgerber <naddy@mips.inka.de> wrote:
>On 2022-12-01, Kenny McCormack <gazelle@shell.xmission.com> wrote:
>
>> I haven't gotten around to testing this, but it looks like adding:
>>
>> -S /usr/lib/sftp-server
>>
>> to the "scp" command line would enable the new behavior (i.e., unless/until
>> I get the newest versions of things installed on my system). Is that
>> correct?
>
>No. In either mode, scp will invoke ssh to connect to the remote
>host:
>
>$ scp foo host:bar
>will spawn
> /usr/bin/ssh -x -oPermitLocalCommand=no -oClearAllForwardings=yes \
> -oRemoteCommand=none -oRequestTTY=no -oForwardAgent=no -s -- host sftp
>
>$ scp -O foo host:bar
>will spawn
> /usr/bin/ssh -x -oPermitLocalCommand=no -oClearAllForwardings=yes \
> -oRemoteCommand=none -oRequestTTY=no -oForwardAgent=no -- host scp -t bar
>
>You can use the -S option to replace "/usr/bin/ssh" with something
>else. The only practical use that comes to mind would be a wrapper
>script that calls /usr/bin/ssh with some additional options, given
>that scp doesn't have a configuration file.
>
>- - - -
>
>Nowadays people might no longer know, but Tatu Ylnen wrote ssh as
>a drop-in replacement for the Berkeley rlogin/rsh/rcp suite. The
>scp command was directly derived from the rcp code; rcp in turn had
>been written by Bill Joy all the way back in 1982.
>
>The completely revamped SSH2 protocol gained a whole file transfer
>subprotocol (SFTP), for which OpenSSH has provided the sftp(1)
>client. However, people prefer the scp(1) command line syntax, so
>after years of hemming and hawing, OpenSSH has finally gone ahead
>and moved scp over to SFTP, and fixed the quoting issue in the
>process--or deliberately broke compatibility, however you want to
>see it.

Again, thanks. Very interesting stuff.

--
1/20/17: A great day for all those people who are sick of being told
they don't know how to spell "you're" (or "there").

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor