This post will guide you how to install keychain ssh key manager under Ubuntu/Debian Linux system. How do I install keychain for openSSH to ssh other server.
Keychain is a manager for OpenSSH, ssh, Sun SSh and GnuPG agents. And it acts a frontend to the agents, and allow you to easily have one long-running agent process per system.
Install Keychain in Ubuntu/Debian
If you want to install keychain tools under Ubuntu/debian Linux, you can execute the apt-get command from the command line interface. Type the following command:
$sudo apt-get install keychain
Or
#apt-get install keychain
Outputs:
root@devops-virtual-machine:/home/devops# apt-get install keychain Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: ssh-askpass The following NEW packages will be installed: keychain 0 upgraded, 1 newly installed, 0 to remove and 271 not upgraded. Need to get 27.4 kB of archives. After this operation, 81.9 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 keychain all 2.8.1-0.1 [27.4 kB] Fetched 27.4 kB in 3s (9,090 B/s) Selecting previously unselected package keychain. (Reading database ... 178997 files and directories currently installed.) Preparing to unpack .../keychain_2.8.1-0.1_all.deb ... Unpacking keychain (2.8.1-0.1) ... Processing triggers for man-db (2.7.5-1) ... Setting up keychain (2.8.1-0.1) ...
Create SSH keys
If you want to create private key and public key for OpenSSH, you just need to issue the following command:
#ssh-keygen –t rsa
Outputs:
root@devops-virtual-machine:/home/devops# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:g8/eqZqclcA6kB0DU7ruLs1UQwBRiryjB/7UUzaC8IQ root@devops-virtual-machine The key's randomart image is: +---[RSA 2048]----+ |o+=o. | |o..+. | |oE.oo | | =+++ . | |.o++.o++S | |ooo...++.o | |.=o.oo = | |.o= o.= . . | | oo. =.o.o | +----[SHA256]-----+ root@devops-virtual-machine:/home/devops#
Note: you need to enter passphrase, if you want to keep passphrase as blank ,just press enter key.
The private key and public key have been generated under /root/.ssh/ directory.
root@devops-virtual-machine:/home/devops# ls /root/.ssh/ id_rsa id_rsa.pub