Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rsa public key No such file or directory?

I'm trying to follow along the Upskillcourses.com web dev online course. In lesson 11 I'm supposed to link up cloud9 to github.

I'm trying to get the SSH key. But it's not working:

ec2-user:~/environment $ cat ~/.ssh/id_rsa.pub
cat: /home/ec2-user/.ssh/id_rsa.pub: No such file or directory

I've copied it exactly like the instructor did. I'll be honest in that I don't really know what I'm doing or how to fix. Seems like no one else is having this problem. Thanks for any help

like image 350
Coder117 Avatar asked Jul 13 '18 23:07

Coder117


People also ask

Why can't I create a new RSA key pair?

so it fails because there is no existing id_rsa file. If you want to create a new RSA key pair, run the command without the -y option, i.e. Thanks for contributing an answer to Ask Ubuntu!

What are the filenames of the public and private keys?

By default, the filenames of the public keys are one of the following: id_xxxx.pub (ex: id_rsa.pub). If you don't have an existing public and private key pair, create one using this command:

How do I get a public SSH key for a directory?

Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following: id_xxxx.pub (ex: id_rsa.pub). If you don't have an existing public and private key pair, create one using this command:

Is ssh/id_rsa no such file or directory?

Yes, you see the problem correct, I'm not asking about .ssh/authorized_keys: No such file or directory. I knew that there are tons of posts concerning the famous authorized_keys priviledge setting. But this ~/.ssh/id_rsa: no such file error have almost no information on the web.


1 Answers

First, check for existing SSH Key using the following command:

ls -al ~/.ssh

Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following: id_xxxx.pub (ex: id_rsa.pub). If you don't have an existing public and private key pair, create one using this command:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

This creates a new ssh key, using the provided email as a label. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location. At the prompt, type a secure passphrase.

If you see an existing public and private key pair listed that you would like to use to connect to GitHub, or once you are done with the above key generation step, you can add your SSH key to the ssh-agent with the following commands:

eval "$(ssh-agent -s)"

ssh-add ~/.ssh/id_rsa (Add -K option, if on MAC OS, as it will add the passphrase in your keychain when you add an ssh key to the ssh-agent.)

Source: https://docs.github.com/

like image 171
Nikita Jain Avatar answered Sep 17 '22 20:09

Nikita Jain