SSH Config Tool is a command-line utility for managing SSH configuration files. It allows you to manage your SSH config files using more expressive YAML/JSON formats while still being able to round-trip them back to classic ssh_config syntax.
- Converts YAML/JSON representations into standard SSH config files
- Converts classic SSH config files into YAML or JSON for easier editing and review
- Scans a single file or an entire directory tree (such as
~/.ssh) while skipping key material and other non-config files - Supports reading configuration from files or standard input (stdin)
- Supports output to files or standard output (stdout), creating parent folders when needed
- Automatically detects the input format (YAML/JSON/SSH Config) and tidies trailing blank lines
Use Docker or download the binary file suitable for your system and CPU architecture from the GitHub release page.
ssh-config [options]Run without arguments to export all SSH configuration under ~/.ssh to YAML on standard output:
ssh-configOr, use Linux pipes to manipulate files:
cat input_file | ssh-config -to-yaml > output_fileDownload docker image:
docker pull soulteary/ssh-config:latest
# or
docker pull ghcr.io/soulteary/ssh-config:latestConvert file (test.yaml) in the current directory to YAML (abc.yaml):
docker run --rm -it -v `pwd`:/ssh soulteary/ssh-config:latest ssh-config -to-yaml -src /ssh/test.yaml -dest /ssh/abc.yamlJust want to see the conversion results:
docker run --rm -it -v `pwd`:/ssh soulteary/ssh-config:latest ssh-config -to-yaml -src /ssh/test.yamlIf you want to use Linux pipelines, you can first enter the Docker interactive command line:
docker run --rm -it -v `pwd`:/ssh soulteary/ssh-config:latest bash
cat /ssh/test.yaml | ssh-config -to-yaml-to-yaml, -to-json, -to-ssh: Specify output format (yaml/json/config), only one output format can be specified at a time.-src: Specify the original configuration file or directory to read from. When omitted, the tool scans~/.ssh.-dest: Specify the path to save the configuration file. When omitted, the converted result is written to standard output.-help: View program command-line help
- Export the SSH configuration for your current user to YAML (default behaviour):
ssh-config- Convert YAML format to SSH config format:
ssh-config -to-ssh -src input.yaml -dest output.conf- Convert SSH config format to JSON format:
ssh-config -to-json -src ~/.ssh/config -dest output.json- Read from standard input, output to standard output, and save in YAML format:
cat input.conf | ssh-config -to-yaml > output.yaml- Go 1.23+
go buildgo test -v ./... -covermode=atomic -coverprofile=coverage.out && go tool cover -html=coverage.out -o coverage.htmlIssues and pull requests are welcome.
This project is licensed under the Apache License. See the LICENSE file for details.
- Useful OpenSSH software
- Inspiration for the definition of configuration files
