SSH ping
SSH-based ping that measures interactive character echo latency and file transfer throughput. Pronounced "shipping".
A continuation and re-work of the original ssh-ping in Rust.
Installation
Cargo
sshping is published on crates.io, you can install it with (first having rust toolchain installed):
Homebrew (macOS/Linux)
sshping is also available on Homebrew/Linuxbrew, you can install it with:
Pre-built binaries
Pre-built binaries are available on the releases page. You can download the binary for your platform and put it in your $PATH.
From source
To install from source, you can clone the repository first:
# Or
# Then
Then build and install it with cargo:
Usage
<TARGET> [user@]host[:port]
)
)
)
Examples
Ping a host from ssh config with human-readable output and modern table style with rounded corners:
Ping a certain host with username and port, using _ as delimiter and a specific identity file:
| | | |
| | | |
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
| | | |
|
| | | |
Output results in JSON format:
{
}
Contributing
Contributions are welcome! Feel free to open an issue or a pull request. Anything from bug report to feature request to code contribution is appreciated.
Currently, there are a few things that can be added but haven't been yet. If you would like to help but don't know where to start, you can check this list below:
- Table style customization
- Unit tests
- Man page generation
- Shell autocompletion script generation
- Packaging for various platforms
- More SSH tests
- Better error handling
- Code optimization
FAQ
How to use public-private key pair for authentication?
Using public-private key pair is recommended. Provide the identity file (private key) path through the -i argument:
If your private key is encrypted with a passphrase, you can either:
- Provide it via the
-pflag:sshping user@host -i ~/.ssh/id_rsa -p "your-passphrase"(not recommended for security) - Let the tool prompt you interactively (recommended): When running in an interactive terminal, you'll be prompted to enter the passphrase securely
Authentication identity precedence is resolved per endpoint (target and each ProxyJump hop) in this order:
- SSH config
IdentityFilefrom the matchingHostblock for that endpoint - CLI
--identityfile - Fallback key discovery/default auth attempts (for example default keys under
~/.ssh)
This means proxy hops can use their own configured keys while the target can use a different key or fall back.
What about password authentication?
Password authentication is supported but not recommended. If no public key authentication is configured, the tool will:
- Use the password provided via
-pflag if available - Prompt you interactively for a password for the specific
user@hostendpoint when running in an interactive terminal (recommended over-pflag) - Fail if neither is available or in non-interactive environments (scripts, CI/CD)
Why isn't XXX functionality of SSH supported?
Many features like BindAddress are currently not supported due to the limitation of upstream libraries.
If they got implemented in the upstream libraries, they will be added to this project as well. Or you can open a pull request to add them yourself!
Why isn't all my identity file in SSH config being used?
If more than one identity file is given in the configuration file, only the first one will be used. This is an opinionated design choice to keep the implementation simple.
Shell autocompletion doesn't work
Make sure you have downloaded the completion script and sourced it in your shell profile, or place it in the appropriate directory for your shell.