Subject: Trouble between libssh2 and scponly

Trouble between libssh2 and scponly

From: Maxime Larocque <>
Date: Tue, 13 Nov 2012 09:10:40 -0500


We have some troubles using curl+libssh2 to access a scp URL. The remote
system is using "scponly" as the login shell. Other scp clients
(command-line scp, winscp) can access the server correctly.

libssh2's ticket #71 has added the shell_quote function to quote the
path before sending the command. This causes the path to be unrecognized
by scponly; probablement because it does not interpret the quotes.
shell_quote was added to support spaces in filenames.

I have done a patch to only add single quotes when a space is present on
the path, but I am not sure if it is the correct solution or if it will
work correctly with other systems. Admittedly I have some more test to
do on my side.

What should be the correct solution in this case?

1. Only add single quotes when a space is present on the path (are there
other characters that have to be escaped - single quotes and backslashes
are already escaped)

2. Instead of quoting everyhting, replace the space by "\ "

3. Nothing in libssh2 - scponly is broken and should be repaired (which
is not exactly acceptable in my case)

I am seeking your experience on this to be sure to have an optimal


Maxime Larocque

Received on 2012-11-13