Cannot find ssh keys on rasperry pi

Hi, I was able to generate the keys thanks to Will’s video and in the terminal i can see where it says they are saved to but I can’t find them. I am working on my pi and Will’s video shows where to find them in Ubuntu. I have looked in many files but I cant seem to locate, so I am stuck.

1 Like

That’s because they are in a hidden folder. While in terminal, type:

cd ~/.ssh

You will find all your keys in there the next moment you type in:

ls -l

:slight_smile:

1 Like

I did what you said and it doesn’t look like the key that Will showed on his video.
Do you want me to type what came up in the terminal??

I just tried the ls -a that i learned hours ago and now the .ssh is in the hidden folder list. It was not there before so thank you! I do remember this point in Will’s video so I’ll get back at it.

You can take a photo of it (or copy/paste it, if it’s faster).
If you want to regenerate the keys, simply execute:

ssh-keygen

In terminal and they will be created for you. Just press Enter for the default location when it asks you, and then you can set your desired pass-phrase (password) or not. :slight_smile:

Is the key called a fingerprint? That is the only thing that came up that looked like it could be a key, it isnt very long though.
It is telling me that my public key is saved in /home/pi/.ssh/id_rsa.pub.
This is what I cannot find and open. I’m sorry, this is kind of a mind bender for me lol!

If i type in ssh-keygen again will it e the same keys it generated this morning?

Yes, the directory is the same I gave you earlier. When you type in the tilde (~) symbol, it takes you to the home folder, regardless of the user.

However, when you execute the ssh-keygen, it will create new keys that are different.

Generally, for the keys to work, you’ll need to copy your ID to the Raspberry Pi. Have you done that yet? If not, you will still be prompted for a password.

I have not copied an ID, I have only created a password for the pi. Would that be the IP address?

I started from the begining again and I still am not seeing a file (like Will is showing) in the file manager that will show me the keys.

OMG, I found it. Thank you Vasileios.

1 Like

I apologize for the late response. We were having a Linux presentation video, which went for a bit longer than expected. Glad you made it & you’re very welcome! :slight_smile:

No apologies necessary Vasileioos, I was watching the presentation.

I just wanted to let anyone know, who may be looking at this thread for answers, where I found the file that the ssh keys were in. Open the file manager (upper left hand corner of home screen), select etc folder and then you will find and open the ssh file there. I had quite a bit to choose from there and this is what it said underneath

ssh_host_rs
a_key.pub

open it with Libre Office

There is a private key right next to it.
One more step in the right direction! Best wishes!

1 Like

Hi Vasileios, I just set up my VPS with the help of Will’s video “Harden the security of your vps”. I am at the end where it is time to set up the firewall. Will is using Ubunto but I am on a Raspberry pi400. sudo ufw allow ssh is the command I typed in and the response that i received was sudo: ufw: command not found
I don’t know if I need to install a firewall or what exctly. I’m stuck…again. Please help :slight_smile:

1 Like

I kept looking throughout the forums and I found your answer to my question from 100 monkey’s post. Thank goodness for all of ou, I could never do this on my own :sweat_smile:

Silly question but I just don’t know, do you always end a terminal session with exit?

1 Like

It would appear you found the solution! Congratulations!
Whenever it says “command not found” - you just need to install it. The simplest way, if you don’t know the full package name, is to use:

apt search <name>

And you’ll get the according findings. Usually, the one with the least words (in this case, a simple “ufw”) will be what you need. There are other ways to search for specific files within packages (if the one you’re looking for returns no results), but I’ll get to that if you ever need it. :slight_smile:

Per the terminal session, not necessarily. I do that when I’m remotely connected via SSH or am logged as root (via “sudo su” in Debian-based distros, or “su” in Arch and RedHat ones). I just do the “exit” out of habit.

1 Like

I had to re install Kubunto, and my SSH Key is gone. Now when I log into Linode, I have to use password. Can I just generate a new SSH key or is there a way to retrieve it from Linode?

It’s best to generate a new one via the ssh-keygen command. Then go to your Linode account and select to add a new SSH key. Then, execute:

cd ~/.ssh
cat id_rsa.pub

Copy the text that comes out and paste it in the big window of the SSH key that Linode pops up. You can name that key as you like.

Screen Shot 2022-01-13 at 5.06.04 PM

cat id_rsa.pub - This did not create an SSH key. Got an error. Used ssh-keygen and that worked. Also used the ssh-copy-id to get this to the VPS
All is now good.

Thank you

1 Like

Good work!
The cat command is to display the contents of a text file that already exists. Which is why I posted the ssh-keygen command first (to create the file). :slight_smile:
What matters is that you got through!