ssh-keygen error: Passphrase is too short - hadoop

I was trying to install hadoop on my system in which I need to configure SSH to access to localhost. But while generating the keygen using the command
ssh-keygen -t rsa -P --
But while generating this keygen I got the following error
anamika#Alex:/home/alex$ cd
anamika#Alex:~$ ssh-keygen -t rsa -P --
Generating public/private rsa key pair.
Enter file in which to save the key (/home/anamika/.ssh/id_rsa):
Created directory '/home/anamika/.ssh'.
Saving key "/home/anamika/.ssh/id_rsa" failed: passphrase is too short(minimum five characters)
anamika#Alex:~$ exit
alex#Alex:~$
What is passphrase here? Also I tried to give some file name to save the key but still it didn't work.

Looks like you are mistakenly writing hyphen in place of double quotes in the second line:
anamika#Alex:~$ ssh-keygen -t rsa -P --
replace the above with the following
anamika#Alex:~$ ssh-keygen -t rsa -P ""

Related

failed to push the branch to the remote repository

Hello I am trying to push an branch in visual studio there is an error :
When I tried the following windows is shown:
and
I have inserted my credentials but without success.
Is it other way o solve this issue?
You might as well using the git cli.
First you need to create an SSH Key.
--- Linux :
ssh-keygen -t rsa -b 4096 -C "yourGitHubMail#youmail.com"
press 'Enter' a a couple of times
after that you should get a success message.
copy your id_rsa.pub
cat ~/.ssh/id_rsa.pub
--- Windows :
Create folder if exists, and create SSH Key
mkdir /Users/username/.ssh && cd /Users/username/.ssh
ssh-keygen -t rsa -b 4096 -C "yourGitHubMail#youmail.com"
Copy the code was outputed.
Go to you github page and press 'Settings' => 'SSH and GPG Keys'
Click 'New SSH Key'
in the test area under 'Key', paste in your SSH key.
You shoul generate an application password (access token) in GitHub and filling it in instead of your password and it will works ! Doc here

Openssh Private Key to RSA Private Key

(I am using MAC)
My id_rsa starts with
-----BEGIN OPENSSH PRIVATE KEY-----
but I expect it to starts with
-----BEGIN RSA PRIVATE KEY-----
I have send my id_rsa.pub to server administrator to get the access to server, so I don't want to generate a new key.
Is there any way that I can transfer my id_rsa which is a openssh private key to a RSA private key? (command please.)
If I can transfer, do I also need to transfer id_rsa.pub? (command please.) It seems id_rsa.pub doesn't have a header like id_rsa, so I am not sure if I should also transfer this.
You have an OpenSSH format key and want a PEM format key. It is not intuitive to me, but the suggested way to convert is by changing the password for the key and writing it in a different format at the same time.
The command looks like this:
ssh-keygen -p -N "" -m pem -f /path/to/key
It will change the file in place, so make a backup of your current key just in case. -N "" will set the passphrase as none. I haven't tested this with a passphrase.
The public key should be fine as is.
For full explanation of the above command, see the -m option here: https://man.openbsd.org/ssh-keygen#m
Here's what worked for me for an in-place conversion of a key with a passphrase:
ssh-keygen -p -P "old passphrase" -N "new passphrase" -m pem -f path/to/key
Install and open puttygen
Click on "Load an existing private key file"
Click on menu item "Conversions" -> "Export OpenSSH key"
Save file
You can achieve this easily if you can get your hands on a linux system. I am using ubuntu 18.04 and did the following:
update packages: sudo apt update
install putty: sudo apt install putty
install puttygen: sudo apt install putty-tools
convert the private key to the intermediate format SSHv2: puttygen yourkey -O private-sshcom -o newkey
convert it back to RSA/PEM: ssh-keygen -i -f newkey > newkey_in_right_format
And you are good to go
Some of the answers above didn't work and I actually ran into yet another problem when trying to create a RSA private key from the OpenSSH private key using ssh-keygen command: unsupported cipher 3des-cbc. A helpful gist for that problem can be found here: https://gist.github.com/twelve17/0449491d86158960fdb630160799ff23.
The following command worked for me to create a valid and working RSA private key from a (Putty on Windows generated) OpenSSH key using:
$ sudo apt install putty-tools
$ puttygen existing_key.ppk -o id_rsa -O private-openssh
# enter passphrase if needed

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%

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

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.

Generate SSH key on windows via command to specify email address

I have generated my keys using PuttyGen but need to be able to specify exactly the email address used with the following command but this doesn't work as I get an 'is not recognized as an internal or external command error'
ssh-keygen -t rsa -C "joebloggs#mycompany.com"
Can anyone assist in running this command on Windows 10?
You can use PuTTYgen to generate a key with those settings.
For the key type -t rsa you have to select SSH-2 RSA
and for the email / comment -C "joebloggs#mycompany.com" you have to set the Key comment field to joebloggs#mycompany.com
After clicking Generate your can get your public key from the Public key for pasting into OpenSSH authorized_keys file field (this is the same as id_rsa.pub when generated with ssh-keygen)
If you also need the private key to be saved in OpenSSH format just go to Conversions > Export OpenSSH key (this is the same as id_rsa when generated with ssh-keygen)

Resources