# Sending files over ssh connection

**URL:** <https://forum.crystal-lang.org/t/sending-files-over-ssh-connection/5831>\
**Category:** Help & Support\
**Created:** [July 14, 2023, 2:23pm UTC](https://forum.crystal-lang.org/t/sending-files-over-ssh-connection/5831 "2023-07-14T14:23:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![snackist](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/snackist/32/2083_2.png) [@snackist](https://forum.crystal-lang.org/u/snackist)\
**Post date:** [July 14, 2023, 2:23pm UTC](https://forum.crystal-lang.org/t/sending-files-over-ssh-connection/5831/1 "2023-07-14T14:23:07Z")

</div>

Hi,

I’m new to Crystal, and so far mostly so good. However I can’t figure out how to send commands to another host via ssh. The current goal is a very simple static site generator for small internet protocols, that can upload files over ssh directly to specified servers…

Actually I’m also struggling with learning about secure connections in general – the ‘client’ example in the OpenSSL docs always gives me this error when I try to connect to a known host on my LAN:

“Unhandled exception: SSL\_connect: error:1408F10B:SSL routines:ssl3\_get\_record:wrong version number (OpenSSL::SSL::Error)”

I’m on MX Linux, roughly Debian 11 if that helps.

Can anyone please point me towards some information on what I might have missed/misread/misunderstood, or point me the way of a useful article on Crystal and SSL/SSH?

Thanks!

---

<div class="post-metadata">

**Author:** ![straight-shoota](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/straight-shoota/32/36_2.png) [@straight-shoota](https://forum.crystal-lang.org/u/straight-shoota)\
**Post date:** [July 14, 2023, 5:29pm UTC](https://forum.crystal-lang.org/t/sending-files-over-ssh-connection/5831/2 "2023-07-14T17:29:32Z")

</div>

The error message indicates that you might not be talking to an SSL endpoint.  
Can you perhaps share some exact steps to reproduce this situation?

For SSH, you might want to look into this shard: [GitHub - spider-gazelle/ssh2.cr: libssh2 binding for Crystal language](https://github.com/spider-gazelle/ssh2.cr)

---

<div class="post-metadata">

**Author:** ![snackist](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/snackist/32/2083_2.png) [@snackist](https://forum.crystal-lang.org/u/snackist)\
**Post date:** [July 14, 2023, 7:21pm UTC](https://forum.crystal-lang.org/t/sending-files-over-ssh-connection/5831/3 "2023-07-14T19:21:45Z")

</div>

You’re right, it was an endpoint issue – I had tried to connect to the wrong subdomain.

The ssh2.cr shard looks really good. I was connected to a local and a remote server in no time flat 🙂

Thanks!
