mody5
I spent more than a day trying to figure out how to connect via ssh using a private key but without a result.. all languages some to have an example when it comes to ssh except erlang/elixir which I don’t know why it’s that hard.
The only example I can find is using username/password, but I want to ssh to another machine using username and private ssh key (id_ed25519),
Any idea?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
D4no0
If you are using OTP, it’s always worth checking out the official documentation. Here is how to configure custom keypairs for servers and the next paragraph is for clients: ssh — OTP 29.0.2 (ssh 6.0.1)
The parameters that can be sent to the client/daemon are also clearly documented, take a look through them: ssh — OTP 29.0.2 (ssh 6.0.1)
mody5
Ok I believe this is so easy for you so please just add that one line or 2 missing lines where I have put a placeholder for completion (my private key is located in /home/me/.ssh/id_ed25519)
BTW I am really newbie to OTP, but I am sure you an experienced on these stuff.
mody5
I am still waiting for the “it’s easy to do” guy to answer, but unfortunately the easy things are not easy. Said is always easier than Done. Anyway!
D4no0
You can PM me and I’ll hand you the consulting prices, then you won’t have to wait anymore
.
mudasobwa
For the record, I re-read the comment you are referring to three times and hereby I admit it does not have wording “it is easy to do.”
It suggests reading docs. Which is the great advice, btw. You might also read something about SSH in a nutshell, because your attempt to pass the username alongside with the file hints you are not quite familiar with it.
Hermanverschooten
As far as I can tell the only way to do this is to implement a ssh_client_key_api callback.
The default is to look for the key files in the
.sshfolder, this you can override withuser_diroption.I have never used it myself, but saw a reference to a package called librarian that seems to support it.
If you want to write it yourself, you can look at how they do it.
al2o3cr
A good starting point IMO is the example in the
:sshuser guide.That shows the general shape of things (
connect/session_channel/exec) but doesn’t really use the messages, or answer your original question.For the “using the messages” part, take a look at how
SSHExdoes it - the whole file is worth reading, but this is where the actual{:ssh_cm, ...}messages get handled:https://github.com/rubencaro/sshex/blob/9758aeba36d94efbac061a03e57d673fc031591f/lib/sshex.ex#L226-L250
For the second half, there are two behaviours that
:sshdepends on but the one we care about is:ssh_client_key_api. That’s implemented by two modules supplied with:ssh,:ssh_fileand:ssh_agentwhich use either files or the SSH agent.:ssh_fileis the default, but you can pass an alternative implementation via the:key_cboption to:ssh.connect.HOWEVER
:ssh_client_key_apihas more moving parts than just “here is a key”, it also deals with known hosts. SSHEx includes an implementation you could use / model after:https://github.com/rubencaro/sshex/blob/master/lib/sshex/configurable_client_keys.ex#L10-L26
axelson
It’s not fully maintained but I’ve used GitHub - labzero/ssh_client_key_api: An Elixir implementation of the Erlang `ssh_client_key_api` behavior. · GitHub to connect using an ed25519 key.
However I had to create a PR for it to work on OTP 25
https://github.com/labzero/ssh_client_key_api/pull/24
But overall it’s not that much code so you might be able to instead use that as inspiration and write your own library.
spinlock99
It’s too bad this conversation didn’t result in documenting a solution to the use case of connecting using ed25519. I’m trying to use
bootlegwhich is build on top ofsshkitandssh_client_key_api. Right now, I can’t determine if the problem is with those (somewhat outdated) project or if it’s just mespinlock99
Thanks for this branch. I’ve got a pretty stock
bootlegandsshkitbut now that I’ve used your branch ofssh_client_key_apiI’m able to authenticate with ed25519!It’s too bad that Labzero isn’t maintaining
bootlegandssh_client_key_apibecause they are good solutions for exactly what I’m trying to do.