Does anyone know of a stable, low-overhead, flexible crate for remotely executing commands over ssh? I’m looking for something like https://pypi.org/project/spur/
If nothing exists, I will strongly consider writing one, as I am getting tired of writing configuration scripts in python… (too many secret type errors)
Thanks in advance!
I ended up writing it: https://github.com/mark-i-m/spurs
Feedback appreciated, though I might be a bit slow to respond.
That looks like a neat little utility! Have you thought about adding things like file transfers, or is it more targeted at being a convenient programmable SSH client?
I have thought about it, but haven’t had time to read the SSH API for file transfer. So far I just run scp or git clone using std::process::Command… It would also be nice to add a utility for creating a file remotely from a template or something.
I am running some experiments which require a lot of setup and configuration. With this library, I can just write a CLI tool that sets up and runs the experiment reproducibly. Basically it allows you to run a shell script remotely via SSH, and it allows some things that are not possible with shell, such as running some computation locally between remote commands.
If you’re using
std::process::Command then there’s no reason why you can’t ask
ssh to [pipe
stdin to a file] on the remote system. It would be pretty easy to create an
io::Write implementation that automates the process and can be passed to a templating engine’s
That sounds pretty cool! It seems like you’ll also want to optimise for development time over execution, so it probably wouldn’t make sense to use something like
futures to run commands and computation concurrently.
Either way, I know which library I’ll be reaching for the next time I need to do SSH stuff from Rust
I believe there is also a (not-recursive) file copy function too… but I will definitely keep that in mind.
Yep, that’s exactly right! I also haven’t optimized copying and cloning values or heap allocation. For most of my workloads the overwhelming majority of time is spent on the remote, so optimizing the local side isn’t worth it.
Though it’s good that you bring that up. I intend to update the Readme to be more helpful, and that sounds like a useful thing to include.
Let me know if you have any suggestions