SSH Keychain: Linking SSH Configurations between Multiple Systems
Secure Shell (SSH) is a widely-used protocol for secure remote login from one computer to another. It is a replacement for Telnet and other insecure remote shell protocols. SSH provides strong password authentication and encrypted communications between two systems over an insecure network.
SSH Keychain
SSH Keychain is a tool that simplifies SSH authentication by managing keys and agents. It allows users to authenticate with an SSH server using a private key without having to enter the passphrase every time. SSH Keychain is available on macOS and Linux systems.
Linking SSH Configurations between Multiple Systems
In some cases, it is necessary to use SSH keys to connect to a remote server from multiple systems. For example, a developer may need to access a remote server from both their laptop and desktop computers. In this scenario, it is possible to use an SSH keychain to link the SSH configurations between the two systems.
Preconditions
Before linking the SSH configurations, the following preconditions must be met:
- SSH agent must be running on both systems.
- The user must have access to the private key on both systems.
- The remote server must allow connections using the public key.
Schematic
ssh > B > C
using using SSH keys
Procedure
- Generate a new SSH key pair on the first system (A) using the following command:
ssh-keygen -t rsa
- Add the public key to the authorized_keys file on the remote server (C) using the following command:
ssh-copy-id user@remote-server
- Export the SSH agent socket from the first system (A) using the following command:
ssh-agent -s > ~/.ssh/ssh-agent.env
- Import the SSH agent socket on the second system (B) using the following command:
source ~/.ssh/ssh-agent.env
- Add the private key to the SSH agent on the second system (B) using the following command:
ssh-add ~/.ssh/id\_rsa
Linking SSH configurations between multiple systems can simplify the authentication process and improve productivity. By using SSH Keychain, users can authenticate with an SSH server using a private key without having to enter the passphrase every time. The procedure outlined in this article provides a simple and secure way to link SSH configurations between multiple systems.