Last active
August 12, 2021 12:21
-
-
Save farhangithub27/7ca6a4696314d2b195eb91ee85958bda to your computer and use it in GitHub Desktop.
ssh configurations to store private key passphrase into mac os keychain and ssh agent so that we dont have to enter password each time we ssh into a remote server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# got into ~/.ssh folder and do vi config | |
# Enter following lines | |
# Host server.example.com | |
# OR for all host | |
# config file takes precedence over cli commands | |
# if oyu run ssh -i ~/.ssh/id_ed25519 test-bunsen.private.teg.io even though we have mentioned diffreent file by using i. | |
# rsa file will take the precendece and will be tried first e.g | |
# ❯ ssh -i ~/.ssh/id_ed25519 test-bunsen.private.teg.io | |
# Enter passphrase for key '/Users/farhansaeed/.ssh/id_rsa': | |
# Enter passphrase for key '/Users/farhansaeed/.ssh/id_ed25519': | |
Host * | |
IdentityFile ~/.ssh/id_rsa | |
UseKeychain yes | |
AddKeysToAgent yes # stores for life time | |
AddKeysToAgent # will store the key file along with password for mentioned time | |
# Optionally replace ~/.ssh/id_rsa with the path to your key. To add additional keys, add a new line for each key with: IdentityFile /path/to/your_key. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment