Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm writing a perl program where I want to accept all kinds of "file names" from the user, including /home/foo/bar.txt and scp://server/some/file.txt or whatever. And then I thought that if I can find a cmd line program that does it, I'll find a perl module that does it too, or I'll just run it through perl's system() call.

I thought of cURL and/or lftp, but on ubuntu, I get:

> curl scp://server/some/file
curl: (1) Protocol scp not supported or disabled in libcurl
> lftp -c 'get scp://server/some/file'
get: scp - not supported protocol

For curl I investigated why that was on Ubuntu and found curl and pycurl is not compiled with sftp support - basically it ain't gonna happen unless I recompile libcurl*, but I don't want to require my users to apply a patch to libcurl*.

Sure, I can write it myself as in:

if ($proto eq 'scp') {
    # handle scp
    open I, 'scp ...' or die;
} elsif ($proto eq 'http') {
    open I, 'wget ...' or die;
} else {
    # whatever
}

But I'd much rather somebody else write/test/debug that with a huge list of protocols and I'm surprised I couldn't find anything that does this out-of-the-box! Do you know of any that I missed?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I believe protocol name is sftp, not scp.

In my system, following works: lftp -c 'get sftp://someserver/file', as well as ftp and http.

share|improve this answer
    
Yup, you're right. I investigated curl didn't support either of scp or sftp and didn't bother checking that for lftp too. Sorry for the noise! I'll use lftp! –  Peter V. Mørch Jun 10 '11 at 8:09
2  
SCP and SFTP are distinct protocols. An SSH server can be configured to accept one but not the other, though I doubt there are many that accept SFTP but not SCP. And then there are FTPS, FISH and a few others. –  Gilles Jun 10 '11 at 21:51
    
yep, you are right –  rvs Jun 11 '11 at 8:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.