3

I have a RHEL5 box with sftp access to a central server. No ssh, not anything else but sftp. SFTP is nice, but it's interactive. I've heard of scp variants that use sftp protocol under the hood, but can't find an RHEL RPM for those. So I'm looking for either a pointer to an RPM I can use, or a source package I can build to get this, or an alternate non-interactive sftp front end.

I have scp on the RHEL machine, but it clearly doesn't speak sftp because when I try I get "This service allows sftp connections only."

Anyone have any ideas?

2 Answers 2

2

cURL speaks SFTP.

yum install curl
1
  • Thanks, perfect! Using it is pretty ugly with SFTP only (you have to pass it a pubkey even though that's not needed for SFTP for instance, and the cmd line arg syntax is verbose and weird) but a couple of quick shell scripts and I'm good to go. (Don't know how to paste code samples into a comment or I'd do it here.)
    – GaryO
    Commented May 11, 2012 at 13:14
1

scp on modern linux uses sftp protocol if possible and falls back to scp if the server does not support sftp. so the answer is affirmative.

5
  • sorry, RHEL5's scp isn't "modern" enough (as I said in the question). Seems like cURL is the best option.
    – GaryO
    Commented May 11, 2012 at 13:14
  • hmm, my rhel 5.4 ssh includes sftp client too. not sure why yours do not. rpm -ql openssh-clients-4.3p2-41.el5.x86_64 | grep sftp -> /usr/bin/sftp
    – johnshen64
    Commented May 11, 2012 at 15:52
  • @joshshen64: I have openssh-clients-5.3p1-70.16.amzn1.z86_64, and it has the sftp client, but that's not what I'm talking about. sftp is interactive (like ftp). I want an SCP-like command line (copy this file from here to there). Some versions of scp can use the sftp protocol apparently, but not mine. I think yours is older, so it probably doesn't either. Try connecting to an sftp-only server with your scp and you'll see what I mean.
    – GaryO
    Commented May 15, 2012 at 15:32
  • 1
    did you try sftp -b batchfile user@server? batchfile specifies all your you need to set up ssh key authentication, either passphraseless, or have ssh-agent set up to forward your credentials.
    – johnshen64
    Commented May 15, 2012 at 16:08
  • not a bad idea. I needed to write a wrapper script around curl anyway (its options are fairly obnoxious), so I bet a similar wrapper script around sftp that created a batchfile would also work. Thanks for the suggestion!
    – GaryO
    Commented May 16, 2012 at 17:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .