using keychain under cygwin
If you want to use the keychain tool under cygwin to aviod entering your passwort for your external server again and agin, you may follow my short guide:
In the follow example I work on my home PC named master and want to use the keychain tool with my server test-server.de.
- Install the keychain tool under cygwin
- Start you cygwin bash and generate your own private and public key pair:
ssh-keygen
Of course you should set a password for your private key. The keys are now in $HOME/.ssh/
- Copy your public key from $HOME/.ssh/id_rsa.pub to your test-server.de (in a temporary folder)
- Login to your test-server.de
- Copy the content of your public key and insert it at the end of your $HOME/.ssh/known_host. If the file does not exists, create a new one.
- Logout from your test-server.de
- Now you can do the following every time you start your cygwin shell:
- Start the keychain tool with your private key:
/usr/bin/keychain $HOME/.ssh/id_rsa
- Source the generated sh file from keychain:
source $HOME/.keychain/master-sh
Dependend of your hostname (in my example master) the file name from the keychain directory may differ.
To stop the ssh-agent (which is started in the background from the keychain tool) you may use
keychain -k all
If you have more than one server where you want to connect without retyping the password you can re run steps 3-6 from the guide.
Posted in software Tagged: bash, cygwin, generate, key, keychain, login, ssh, ssh-agent