Adding Support for SCP and SFTP for Curl on Linux

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 20:32:26

Although Curl does support SFTP, support isn't automatically included in the default package.

This website: http://andrewberls.com/blog/post/adding-sftp-support-to-curl provided the details which helped me add the required support for SFTP. As the site didn't work 100% for me, I've outlined the different steps taken below.

Manually downloading libssh2 didn't work for me so I used yum to install the two packages:

yum install libssh2 libssh2-devel

and then followed step two configuring Curl to install using the above libraries

The final step was to restart sshd:

service sshd restart

There you have it. Double check that SFTP is on the list of support protocols by running

curl -V

When I initially tested, Curl complained about key authentication issues, but you can force Curl to use any authentication to connect:

curl --anyauth sftp://user:passwd@127.0.0.1/directory -o Test.txt

This will round robin the different supported authentication methods and let you use you login credentials instead.

I hope this helps alleviate any other headaches for people trying to achieve the same.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!