Menu

#1173 Not able to specify relative path in the SCP URL

closed-fixed
SCP/SFTP (19)
5
2014-08-27
2012-12-12
No

Curl manual states that "With sftp: and scp: URLs, the path name given is the absolute name on the server. To access a file relative to the remote user's home directory, prefix the file with /~/ , such as: curl -u $USER sftp://home.example.com/~/.bashrc"

But the above advertised behavior doesn't work for SCP URLs.

curl --version
curl 7.21.4 (powerpc-pc-netbsd-gnu) libcurl/7.21.4 OpenSSL/1.0.1c zlib/1.2.3 libssh2/1.4.2

# curl scp://lab:lab@10.16.134.207/~/s4810.cfg -k
curl: (79) Failed to recv file

curl scp://lab:lab@10.16.134.207/~/text.cfg -v -k
* About to connect() to 10.16.134.207 port 22 (#0)
* Trying 10.16.134.207... connected
* Connected to 10.16.134.207 (10.16.134.207) port 22 (#0)
* SSH authentication methods available: publickey,password
* Using ssh public key file /f10/.ssh/id_dsa.pub
* Using ssh private key file /f10/.ssh/id_dsa
* SSH public key authentication failed: Unable to open public key file
* Initialized password authentication
* Authentication complete
* SSH CONNECT phase done
* Failed to recv file
* Connection #0 to host 10.16.134.207 left intact
curl: (79) Failed to recv file
* Closing connection #0

SStk-0 # curl sftp://lab:lab@10.16.134.207/~/text.cfg -v -k
* About to connect() to 10.16.134.207 port 22 (#0)
* Trying 10.16.134.207... connected
* Connected to 10.16.134.207 (10.16.134.207) port 22 (#0)
* SSH authentication methods available: publickey,password
* Using ssh public key file /f10/.ssh/id_dsa.pub
* Using ssh private key file /f10/.ssh/id_dsa
* SSH public key authentication failed: Unable to open public key file
* Initialized password authentication
* Authentication complete
Hello world
* Connection #0 to host 10.16.134.207 left intact
* Closing connection #0

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2012-12-13
    • status: open --> open-confirmed
     
  • Daniel Stenberg

    Daniel Stenberg - 2012-12-13

    Thanks for the report!

    I can see this happen as well even with my latest dev version. I've not figured out if this is a bug in the code or in the docs...

     
  • Daniel Stenberg

    Daniel Stenberg - 2012-12-21

    Thanks, this is now fixed in git, commit c30c557e4d2089

     
  • Daniel Stenberg

    Daniel Stenberg - 2012-12-21
    • status: open-confirmed --> closed-fixed
     
  • Balaji Parasuram

    Thanks.