# pylibssh2

**URL:** <https://forum.ansible.com/t/pylibssh2/11528>\
**Category:** Ansible Project\
**Created:** [May 10, 2012, 2:22am UTC](https://forum.ansible.com/t/pylibssh2/11528 "2012-05-10T02:22:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Williams](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Matthew\_Williams](https://forum.ansible.com/u/Matthew_Williams)\
**Post date:** [May 10, 2012, 2:22am UTC](https://forum.ansible.com/t/pylibssh2/11528/1 "2012-05-10T02:22:15Z")

</div>

[https://github.com/wallix/pylibssh2](https://github.com/wallix/pylibssh2)

This library, in my basic tests, seems to be much faster than paramiko. A lot more complex too… But if the general public thinks it’s worth adding this as a connection type, I’ll start hacking away on it for 0.5.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 10, 2012, 2:28am UTC](https://forum.ansible.com/t/pylibssh2/11528/2 "2012-05-10T02:28:03Z")

</div>

C module. Interesting.

Does look like a fair amount of work because higher level wrappers to useful functions don't exist yet.

[https://github.com/wallix/pylibssh2/blob/master/examples/scp\_upload.py](https://github.com/wallix/pylibssh2/blob/master/examples/scp_upload.py)

Much faster say by what percentage?

I think the 0.5 playbook upgrades should be able to streamline operations pretty nicely, so maybe it's not a huge issue then.

--Michael

---

<div class="post-metadata">

**Author:** ![Matthew\_Williams](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Matthew\_Williams](https://forum.ansible.com/u/Matthew_Williams)\
**Post date:** [May 10, 2012, 2:31am UTC](https://forum.ansible.com/t/pylibssh2/11528/3 "2012-05-10T02:31:39Z")

</div>

I don’t have really good benchmarks, but over a vpn (100ms ping to remote), I can do a dozen ops in the time it takes to do two with paramiko. Or something like that. Before I start work on it I’d do some better benchmarking.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 10, 2012, 2:48am UTC](https://forum.ansible.com/t/pylibssh2/11528/4 "2012-05-10T02:48:49Z")

</div>

Another thing to possibly consider is API stability and maintaince overhead.

It looks good, but what other projects are using it yet, etc? Is the library in EPEL yet for ease of RPM dependencies (which is pretty much my gold standard before I use something) -- BTW, we're in EPEL now 🙂

I wouldn't have to be a hard dep, but it looks like a fair amount of code involved, so I want to make sure it's solid and has a future in the distro before we invest too much.

That might just mean doing the work to make sure it's IN the distros, but I wouldn't ask anyone to take on that much.

--Michael

---

<div class="post-metadata">

**Author:** ![Matthew\_Williams](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Matthew\_Williams](https://forum.ansible.com/u/Matthew_Williams)\
**Post date:** [May 10, 2012, 2:56am UTC](https://forum.ansible.com/t/pylibssh2/11528/5 "2012-05-10T02:56:03Z")

</div>

It is in Ubuntu and Debian (python-libssh2), don’t know about the others.

---

<div class="post-metadata">

**Author:** ![Rodney\_Quillo](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@Rodney\_Quillo](https://forum.ansible.com/u/Rodney_Quillo)\
**Post date:** [May 10, 2012, 2:57am UTC](https://forum.ansible.com/t/pylibssh2/11528/6 "2012-05-10T02:57:37Z")

</div>

Hi Matt,

Not sure if this Paramiko fork is also a good replacement:

[https://github.com/bitprophet/ssh.git](https://github.com/bitprophet/ssh.git)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 10, 2012, 2:58am UTC](https://forum.ansible.com/t/pylibssh2/11528/7 "2012-05-10T02:58:58Z")

</div>

libssh2 is in EPEL, python-libssh2 is not, but it's probably something that wouldn't be terrible to add.

That being said, I'm not going to do it, or ask anyone to do it.

Seems reasonable to peruse given inclusion in Debian though. If you want, go for it!

--Michael

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 10, 2012, 3:00am UTC](https://forum.ansible.com/t/pylibssh2/11528/8 "2012-05-10T03:00:43Z")

</div>

I'm not looking to replace paramiko, this stemmed more from a "this looks fast" discussion. We wouldn't get that from the paramiko fork.

If that becomes an issue we can deal with it.

--Michael

---

<div class="post-metadata">

**Author:** ![Matthew\_Williams](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Matthew\_Williams](https://forum.ansible.com/u/Matthew_Williams)\
**Post date:** [May 10, 2012, 3:41am UTC](https://forum.ansible.com/t/pylibssh2/11528/9 "2012-05-10T03:41:24Z")

</div>

For what it’s worth, I quickly hacked this together… at the moment with support only for password auth. Including the (pasted in) password entry, I’m getting over a somewhat slow network connection 9.5s with Paramiko and 3s with pylibssh2. With additional optimization slated for 0.5, Ansible could be downright snappy, even over slower connections.

---

<div class="post-metadata">

**Author:** ![Matthew\_Williams](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Matthew\_Williams](https://forum.ansible.com/u/Matthew_Williams)\
**Post date:** [May 10, 2012, 3:42am UTC](https://forum.ansible.com/t/pylibssh2/11528/10 "2012-05-10T03:42:11Z")

</div>

(That’s for -m command -a ls)
