Use a keychain to remember your SSH password
I like the convenience of a keychain to remember my SSH passwords for remote logins.
Never use a passwordless SSH key. Ever.
Though on my own laptop I get a bit lazy and like to use a keychain to remember my SSH key password so I don’t always have to fetch it from my password safe.
This is how I do it. Don’t do this on any internet available instance.
$ sudo apt-get install keychain
I will assume you already have your own SSH keys. So let’s configure that keychain. I prefer
$ vim $HOME/.bashrc
$ vim $HOME/.bash_profile
Then add the following lines:
/usr/bin/keychain $HOME/.ssh/id_rsa source $HOME/.keychain/$HOSTNAME-sh
--clear option on the
keychain command if you want to make things more secure.
The next time you start your shell, you will enter your SSH password, and from then on you should see something like this:
* keychain 2.8.5 ~ http://www.funtoo.org * Found existing ssh-agent: 9999 * Known ssh key: /home/user/.ssh/id_rsa
2021-12-07 19:00 (Last updated: 2022-04-14 19:55)
9410084 @ 2022-04-14