SSH Key Profile Switcher - A CLI tool for managing SSH key switching for 1Password's SSH agent.
opssh simplifies switching between different SSH key profiles (e.g., personal vs work) by managing the 1Password SSH agent configuration file (agent.toml). It allows you to:
- Store multiple SSH key profiles in a simple YAML configuration
- Quickly switch between profiles without manually editing configuration files
- View and manage your SSH key profiles
- Go 1.25.5 or later
go install github.com/ccxdev/opsshgit clone https://github.com/ccxdev/opssh.git
cd opssh
go build -o opssh
./opssh <command>Add a new SSH key profile:
opssh add <profile-name>You'll be prompted to enter:
- Account name
- Vault name
- Item name
View all configured profiles:
opssh listThe currently active profile will be marked with an asterisk (*).
Switch to a different SSH key profile:
opssh switch <profile-name>This updates the ~/.config/1Password/ssh/agent.toml file with the selected profile.
Display the currently active SSH key profile:
opssh currentRemove a profile from your configuration:
opssh remove <profile-name>Note: If the profile is currently active, you'll receive a warning.
Profiles are stored in ~/.opssh.yaml with the following structure:
profiles:
personal:
account: "myaccount"
vault: "Personal"
item: "My SSH Key"
work:
account: "myaccount"
vault: "Work"
item: "Work SSH Key"--verbose, -v: Enable verbose output--config: Specify a custom config file path (default:~/.opssh.yaml)
# Add a profile
opssh add work
# Switch to work profile
opssh switch work
# Verify current profile
opssh current# Add a profile manually
opssh add personal
# List all profiles
opssh list
# Switch between profiles
opssh switch personal
opssh switch work
# Remove a profile
opssh remove old-profileopssh manages SSH key profiles by:
- Storing profiles in
~/.opssh.yaml- a simple YAML configuration file - Updating agent.toml at
~/.config/1Password/ssh/agent.tomlwhen switching profiles - Reading agent.toml to determine the currently active profile
The tool works with a simple YAML configuration file to manage your SSH key profiles.
- 1Password SSH Agent: This tool is designed to work with 1Password's SSH agent feature
If agent.toml doesn't exist, 1Password SSH agent may not be set up. Ensure:
- 1Password SSH agent is enabled
- The directory
~/.config/1Password/ssh/exists
If you get "profile not found" errors:
- Use
opssh listto see available profiles - Check your
~/.opssh.yamlfile for typos
Please feel free to open an issue or submit a pull request.