Mac OS X key gen without password, can I remove it? - macos

I generated my key pair on a new computer that I'm setting up for my development environment. I am already using my id_rsa.pub key in several places and don't wish to change it. When generating the key, I entered a passphrase and confirmed it. I believe this means that I must enter the passphrase every time my key is used or accessed, such as during ssh into a server or doing a git push to GitHub. I forgot that I could have just hit the enter key and skipped entering a password during generation.
What I want to know is if I can remove the passphrase so that it is as if I had just used the enter key when I was generating it or so that I can use the same key pair without having to use a passphrase. Thanks!

I found what I needed here:
http://www.thinkplexx.com/learn/howto/security/ssl/remove-passphrase-password-from-private-rsa-key
SSH into a host that has your public key: ssh my_user#myhost
At the password prompt, openssl rsa -in ~/.ssh/id_rsa -out ~/.ssh/id_rsa_new
Enter old passphrase
Back up and replace private ssh key:
cp ~/.ssh/id_rsa ~/.ssh/id_rsa.backup
rm ~/.ssh/id_rsa
cp ~/.ssh/id_rsa_new ~/.ssh/id_rsa
Set key permissions: chmod 400 ~/.ssh/id_rsa
Test it by logging in to the remote again.

Related

How to avoid add ssh key everytime when push or pull the code

I generated the ssh pub key and private key and register pub key to my github.
And add the private key by using this
$ eval $(ssh-agent -s)
$ ssh-add ~/.ssh/id_rsa
But I have to put this command everytime when I push or pull the code.
I hope to avoid this.
You should not have to write those commands everytime.
First, the agent is only needed if your private key is passphrase protected.
Second, as explained in "Working with SSH key passphrases", you should be able to automatically launch said agent through a ~/.bashrc resource file, or (for Mac) caching the passphrase in the keychain.

How do I create a bash script to allow me to log into multiple clients on a network without having me enter the password everytime?

I'm on my network but want to be able to quickly log onto multiple clients on it without having to type SSH username#ipaddress everytime and then be prompted for a password. They all have the same password, is there a way for this to be automated? tips and knowledge are greatly appreciated
ssh-keygen
will create your public/private key pair in the ~/.ssh directory. You can enter for every prompt. Please be aware that you should not share ~/.ssh/id_rsa (the generated private key) with anyone. Consider it your password.
The following command will upload your public key to each host in question:
ssh-copy-id username#ipaddress
The above command copies your ~/.ssh/id_rsa.pub (the public key) to the ~/.ssh/authorized_keys file on the remote box. You will be prompted for your password, but that should be the last time.
Once you have copied your public key, you should be able to log in after that without a password.
ssh username#ipaddress

Git Bash - ssh-keygen not working (quits before generating RSA key pair)

It's working fine with Eclipse default git extension and I can do each and every operation using it, I can even generate RSA key.
But when I access git remote using git bash, I got this error:
The authenticity of host '[hostname]:PORT ([IP Address]:PORT)' can't be established.
RSA key fingerprint is SHA256:U...M.
Are you sure you want to continue connecting (yes/no)? fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
and then I removed existing RSA key and tried to generate new RSA key pair and its starts and then quits before completion.
ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/userName/.ssh/id_rsa):
userName#example MINGW64 ~/git/path (branch name):
And I also tried to generate a new RSA key using GIT GUI, I got below error
error writing "stdout": broken pipe
error writing "stdout": broken pipe
while executing
"puts $::answer"
(procedure "finish" line 9)
invoked from within
"finish"
invoked from within
".b.ok invoke"
("uplevel" body line 1)
Thanks in advance.
If you are using a recent version of Git (2.19.2 or more), make sure to generate a PEM private SSH key, not an OPENSSH one.
See "Jenkins: what is the correct format for private key in Credentials"
Use:
ssh-keygen -m PEM -t rsa -P "" -f afile
Then try again your git push, from a simple CMD (no need for bash), using a simplified PATH:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

How to generate key on git bash

I use this command on git bash
`$ ssh-keygen -t rsa -C "eu.json#gmail.com"`
After that, these line of text show.
`'Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/jayson/.ssh/id_rsa):'.`
There is no other line of text shown and stuck there, I wait for long time and still nothing happen not like the video that i follow, I need to use it on laravel homestead.
You are supposed to click ENTER (twice if you don't want a passphrase associated to the private key).
That will validate the file to be saved.
/c/Users/jayson/.ssh/id_rsa (private key)
/c/Users/jayson/.ssh/id_rsa.pub (public key)

Git Always Prompts for Passphrase

I've followed the following guide to setup SSH keys on Mac OS 10.7.4.
https://help.github.com/articles/generating-ssh-keys
But for some reason it continually prompts me for my passphrase. It doesn't prompt me if I don't specify a passphrase, but that isn't desired. Is there a way to cache my passphrase so that I won't be prompted for every pull/push?
You have to add your key file in the ssh-add
ssh-add ~/.ssh/you_key_rsa
After that, it's not will ask any more.
You might need to edit the .git/config file in your git repo and change the url value to use something like user#host:path-to-git-repo.git
The SSH password is used to authenticate users connecting to GIT repositories.
If you're working localy, git shouldn't ask for passwords, obly when doing remote operation, such as clone, push, pull,etc.
If the password annoys you, you can just input a blank password when creating the SSH key, password is not mandatory, however I advise you to use password for extra protection.
I am using Windows 10, and I have found two ways to eliminate the passphrase prompting.
Make sure the ssh agent is started and you have added your key
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa
The second command will prompt you for your passphrase, and then you will not be prompted for any other git commands run in this session.
You will need to run these commands again for every new bash session
Remove the passphrase from you key file:
$ ssh-keygen -p -f ~/.ssh/id_rsa
When prompted, just strike enter key for the new passphrase.
Option 2 will permanently remove the passphrase for all git commands. Of course it also makes you key file "unsecured"
Note: If you are using git desktop GUI ( Version 1.04+) Option 2 is required for the GUI to work.

Resources