How do you avoid typing the password of your ssh key each time, on Linux and Windows with OpenSSH?

Issue

I use a password-protected ssh key (RSA). That means that I need to type the password to decipher the key before using it.

I noticed that on some computers, I don’t need to type the pass of my ssh key each time I need to use it.

On my Windows computer, as well as some Linux servers, I need to do it.

I use OpenSSH on Windows (not Putty), so it is the same key as Linux. Stored in the /.shh directory.

Having a password-protected key is good in case someone steals it. But typing the password each time is annoying.

Is there a way to have my computers, on Windows and Linux, remember it?

I use it from the shell (default Ubuntu terminal and PowerShell, often from VS Code).

Thanks

I tried this, but no success:

(base) PS C:\code> ssh-add -k C:\Users\user\.ssh\id_rsa  
Enter passphrase for C:\Users\user\.ssh\id_rsa: 
Identity added: C:\Users\user\.ssh\id_rsa (C:\Users\user\.ssh\id_rsa)
(base) PS C:\code> git fetch
Enter passphrase for key '/c/Users/user/.ssh/id_rsa': 
🤬🤯🥴

Solution

ssh-agent is the process that keeps your passphrase after the initial unlocking, so you don’t need to type it every time

Linux Basic Tutorial on ssh-agent

Windows SSH documentation

Git Bash for Windows documentation

Answered By – namizaru

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published