36

I'm trying to access a server using Filezilla and was told I needed to use authentication with public/private keys. I created the keys using the Terminal, but cannot find them on my computer.

This is where the key is located: (/Users/ed/.ssh/id_rsa)

I checked in my home directory, but the folder .ssh is nowhere to be found. Is there a secret place .ssh folder is stored and how can I access it?

My Mac runs on OS X ElCaptain. I would really appreciate any help.

miken32
  • 42,008
  • 16
  • 111
  • 154
I Like
  • 1,711
  • 2
  • 27
  • 52
  • Since the directory is starting with a dot it might be hidden from your attempts to find it. Did you try to `cd /Users/ed/.ssh/ ; ls` right into it? – eckes Aug 22 '16 at 18:34
  • "I checked in my home directory, but the folder .ssh is nowhere to be found" Could you describe exactly what you did to look for this directory? – Kenster Aug 22 '16 at 18:56
  • I went to my finder and clicked the home icon. When I try `cd /Users/ed/.ssh/ ; ls` it says there's no such file or directory. – I Like Aug 23 '16 at 00:23

4 Answers4

51

Files and folders starting with a period (.ssh) are hidden by default. To find private/public key, run this commands:

ls -a

In your case, run this commands to find the ssh keys:

cd ~/.ssh

then:

ls -a

Now you should see the keys like this:

.       ..      id_rsa      id_rsa.pub

If the keys are not there then definitely you need to create the key by ssh-keygen command.

Munna Khan
  • 1,902
  • 1
  • 18
  • 24
  • 4
    in my ubuntu : bash: cd: id_rsa: No such file or directory. Just known_hosts file – quangkid Aug 21 '18 at 03:17
  • 1
    @quangkid in such case, either SSH keys were not set up (you have to manually generate them, remember did you do it) or they're located elsewhere. Also, the `id_rsa` is a _file_, not folder, you should not `cd` into it. If it helps, you can open the file in the terminal via a desktop application, for example, if you've got Sublime Text, that would be `subl id_rsa`. Similar for vscode or atom, they have their own "call names". – revelt Aug 08 '20 at 10:58
  • @quangkid If the keys are not there then definitely you need to create the key by ssh-keygen command. – Munna Khan Aug 08 '20 at 14:39
5

(MacOS) I my case, .ssh folder was hidden so I went to folder route (example /Users/syed.dastagir)and pressed Command + Shift + . (full stop/period) and it showed me .ssh folder.

When you no longer want to see the hidden folders just press Command + Shift + . again.

syed dastagir
  • 419
  • 6
  • 8
2

If using Finder, I used defaults

Terminal

write com.apple.Finder AppleShowAllFiles true [Press Return] 
killall Finder

Then I was able to see .ssh directory in Finder at

/Users/MYUSERNAME/.ssh
atazmin
  • 4,757
  • 1
  • 32
  • 23
0

when referencing the private key name, when setting up the config file for GitHub for example ( https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent ), I thought I needed an id with number, i.e 'id_43248390', however I just needed to reference 'id_rsa'.

This is incase any gets blocked similarly.

Anthony Peña
  • 171
  • 1
  • 7