0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/mnt/c/Users/ninja/.ssh/id_ed25519' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

Background info: I just got set up with WSL and I started connecting git with github. I'm new to this so please answer with simplicity if possible.

I'm following the documentation on this site and I was able to create the SSH key, but when I want to add it to the ssh-agent and follow those instructions (ssh-add ~/.ssh/id_ed25519) I get this error (the one above). Any solutions to this?

I'm running Ubuntu on Windows by using WSL.

Aladdin
  • 1
  • 2
  • And to help you wade through all the possible answers on those two questions, [this](https://superuser.com/a/1343737/1210833) should be the one to try first. Add the `/etc/wsl.conf` with those lines, `wsl --shutdown`, and then you should be able to `chmod` the private key on the Windows drive. – NotTheDr01ds Sep 17 '21 at 12:56
  • @Aladdin - I would start by resolving the permission error. The permissions on the key can only be accessible by the owner of the file. – Ramhound Sep 17 '21 at 15:05
  • Replying to what @NotTheDr01ds said, I'm kinda lost on this whole thing. So inside my "home directory" I created a directory called etc and a file called wsl.conf. Inside the wsl.conf I typed this in: [automount] options = "metadata" using VS Code. I later closed wsl by using the wsl --shutdown command. I hope everything I did was correct. Now I don't know how to chmod the private key, this is where I'm lost. – Aladdin Sep 17 '21 at 15:52
  • @Aladdin No offense, but I can see you are a total beginner :-). That's not a problem -- That realization led me to re-read your original question more closely, including the link you provided. I then noticed that you used the *Windows* instructions for creating a new key, when (for WSL) you should select the *Linux* instructions. As a beginner, I realized you probably wouldn't (or shouldn't) be trying to use a Windows ssh private key in Linux/WSL. So follow the Linux instructions on that page and you shouldn't have permission issues anyway. – NotTheDr01ds Sep 17 '21 at 16:05
  • If you'd like, we could still troubleshooting the permission issues, but that's a more advanced topic, and I'd recommend skipping it if you don't really need to. For starters, the `/etc/wsl.conf` that you created is in the wrong directory -- Use `sudo nano /etc/wsl.conf` to put it in the right directory (or whatever editor you prefer). – NotTheDr01ds Sep 17 '21 at 16:07
  • @NotTheDr01ds Yes, I am a noobie, but I was following the Linux section. I did the whole process again (just in case I was doing the Windows one) and I ended up getting the same error. But thanks your last comment I was able to solve this problem. I had to look up what nano was lol. Thank you so much for your time and patience, it is greatly appreciated. I hope you have a good rest of your day! – Aladdin Sep 17 '21 at 17:25
  • @Aladdin No worries - Glad it got you in the right direction. I assumed you used the Windows instructions since the error showed that the key pair was in your Windows profile directory, rather than `/home/userid/.ssh/...` (where it would normally be under Linux). Did you happen to try to change your WSL home directory to be the same as your Windows home? – NotTheDr01ds Sep 17 '21 at 22:20
  • @NotTheDr01ds I ran ` sudo nano /etc/wsl.conf ` and was able to later run ` chmod 600 ` on the SSH keys. After this everything ended up working as intended. – Aladdin Sep 18 '21 at 00:07

0 Answers0